Keksuccino / FancyMenu

Source code for FancyMenu.
Other
164 stars 21 forks source link

JsonPlaceHolder does not validate URLs correctly [Konkrete] #979

Closed Codestian closed 19 hours ago

Codestian commented 2 days ago

Describe the bug The jsonPlaceHolder placeholder for text does not validate URLs correctly. Instead of showing the response from the URL, it only shows the variable code ({"placeholder":"json","values":{"json_path":"$.KEY","source":"URL"}}). However, when the if else statement as shown below is removed and the cachedPlaceHolders.put() method is run, it is able to retrieve data from the URL successfully. The issue stems not from FancyMenu, but Konkrete library, specifically WebUtils.class and method isValidUrl.

To Reproduce Steps to reproduce the behavior (e.g.):

  1. Create text element
  2. Set text content and select Advanced>JSON Parser
  3. Set the URL as "https://api.buildtheearth.net/api/v1/buildteams/43c98aab-e2d1-4a78-8c91-1a3218839e0d"
  4. Set json_path as "$.name"
  5. Click done to view. No data is shown.
  6. Replace line 148 with the code from 145 in customization>placeholder>placeholders>advanced>JsonPlaceholder.java
  7. Repeat steps 1-5 and data from URL is retrieved.

Expected behavior The URL should be validated and data is retrieved.

Game Log Only relevant logs are below.

Screenshots If screenshots would help to explain the issue, please include these.

Screenshot_20241116_004337

Basic Informations (please complete the following information):

Codestian commented 19 hours ago

Solved, just needs to ensure the endpoint for GET returns 200 for HEAD as well.