8000 ServeDir to call fallback for invalid filenames (fixes #573) by aryaveersr · Pull Request #586 · tower-rs/tower-http · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

ServeDir to call fallback for invalid filenames (fixes #573) #586

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

Merged
merged 10 commits into from
Jun 20, 2025

Conversation

aryaveersr
Copy link
Contributor

Motivation

( See #573 )

ServeDir currently returns ISE for any request involving invalid filenames (eg: /path|name/). This fixes it so that it instead forwards the request to the fallback (as it should).

Solution

This uses a rather ugly solution of manually checking Raw OS error codes for windows. If we ever upgrade MSRV to 1.87 or beyond, we should instead use io::ErrorKind::InvalidFilename (stabilized in 1.87). I've also put a comment with FIXME regarding this.

@aryaveersr aryaveersr changed the title ServeDir calls fallback for invalid filenames (fixes #573) ServeDir to call fallback for invalid filenames (fixes #573) Jun 13, 2025
@aryaveersr aryaveersr marked this pull request as draft June 13, 2025 19:42
@aryaveersr aryaveersr marked this pull request as ready for review June 13, 2025 19:57
Copy link
Member
@jplatte jplatte left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the PR, especially for including tests!

aryaveersr and others added 2 commits June 20, 2025 17:31
Co-authored-by: Jonas Platte <jplatte+git@posteo.de>
@aryaveersr aryaveersr requested a review from jplatte June 20, 2025 12:27
Copy link
Member
@jplatte jplatte left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@jplatte
Copy link
Member
jplatte commented Jun 20, 2025

One last thing, could you add a changelog entry please?

@aryaveersr aryaveersr requested a review from jplatte June 20, 2025 12:36
@jplatte jplatte enabled auto-merge (squash) June 20, 2025 12:38
@jplatte jplatte merged commit cf3046f into tower-rs:main Jun 20, 2025
11 checks passed
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.

2 participants
0