Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

File contents endpoint returns invalid Content-Type and wrong status code #964

Open
3 tasks done
masterjanic opened this issue Jan 31, 2025 · 5 comments
Open
3 tasks done

Comments

@masterjanic
Copy link

Current Behavior

When requesting file contents of a file that does not exist via the client api an malformed response is returned.

For exmaple:

GET https://<url-to-panel>/api/client/servers/<server-id>/files/contents?file=<non-existent-file>

Will return:

Content-Type: text/plain; charset=UTF-8
Status: 200
Body: {"error":"An unexpected error was encountered while processing this request","request_id":"..."}

Expected Behavior

When requesting a file that does not exist the api should return a status 404 with the current error message and a Content-Type of application/json.

Steps to Reproduce

Request the contents of any file that does not exist via the client api as outlined in current behaviour.

Panel Version

1.0.0-beta17

Wings Version

1.0.0-beta9

Games and/or Eggs Affected

No response

Docker Image

No response

Error Logs

Is there an existing issue for this?

  • I have searched the existing issues before opening this issue.
  • I have provided all relevant details, including the specific game and Docker images I am using if this issue is related to running a server.
  • I have checked in the Discord server and believe this is a bug with the software, and not a configuration issue with my specific system.
@masterjanic
Copy link
Author

Image

This leads to unwanted behaviour when parsing the contents of the response. The reponse will then be interpreted as text while being an actual json error. In my case it will cause the editor to assume that file has the contents of the error.

@notAreYouScared
Copy link
Member

notAreYouScared commented Jan 31, 2025

I think this has already been addressed and will be included for the next beta release

pelican-dev/wings#54

Edit: This should be in beta 9 of wings. can you verify wings is up to date?

@masterjanic
Copy link
Author

@notAreYouScared Seems like the node I that was actually returning the file for my request was indeed on an older version. With the current version it will throw a 500 error with"code": "FileNotFoundException" 👍 Still not the correct status code though!

@QuintenQVD0
Copy link
Contributor

Is that file in a directory that does not exist?

@masterjanic
Copy link
Author

Image

I am getting the same status 500, and not 404, no matter if the directory exists or both directory and file dont exist

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants