UseStaticFiles does not work with spaces encoded as plus signs
- Dominant language
- C#
- Stars
- 38.4k
- Forks
- 10.9k
- Avg merge
- 2d 10h
- Merged PRs (30d)
- 281
Description
### Is there an existing issue for this?
- [x] I have searched the existing issues
### Describe the bug
`app.UseStaticFiles()` returns 404 for file names that contain spaces and the browser requests them using `+` rather than `%20`.
Such links are easy to come across since `HttpUtility.UrlEncode` uses `+` to encode spaces. `HttpUtility.UrlPathEncode` which encodes spaces as `%20` is [documented](https://learn.microsoft.com/en-us/dotnet/api/system.web.httputility.urlpathencode) as do not use.
### Expected Behavior
The `+` sign to be decoded into space and the files served.
### Steps To Reproduce
1. Create a new ASP.NET project
2. Put a file with space in the wwwroot folder.
3. Request it using `+` for space.
### Exceptions (if any)
_No response_
### .NET Version
10.0.100-rc.2.25502.107
### Anything else?
Running on Microsoft.AspNetCore.App 8.0.21.
Contributor guide
Assessment
This issue has not been assessed yet.