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

Make "Filename too long" return 404 not 500 #2583

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

Jaza
Copy link

@Jaza Jaza commented Apr 30, 2024

Summary

If a static file with a really long name is requested, then it causes an OSError to be raised saying "Filename too long". This error currently gets propagated, resulting in a 500 response. In such a case, the name is too long for the underlying OS to handle, therefore a file with that name couldn't possibly exist, therefore it would be more appropriate to not propagate the error and to return a 404 response.

Checklist

  • I understand that this PR may be closed in case there was no previous discussion. (This doesn't apply to typos!)
  • I've added a test for each change that was introduced, and I tried as much as possible to make a single atomic change.
  • I've updated the documentation accordingly.

Note: I feel that the existing documentation is adequate, it already states:

Static files will respond with "404 Not found" or "405 Method not allowed" responses for requests which do not match.

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

Successfully merging this pull request may close these issues.

None yet

1 participant