File Middleware strips query parameters with redirect
Captain-Kirkie opened this issue · 2 comments
Captain-Kirkie commented
Describe the bug
When using the the DirectoryAction .redirect on FileMiddleWare we lose any query parameters sent with the request on redirect.
Example:
GET /Utilities?test=test -> 301 Moved Permanently /Utilities/ (Query parameters are stripped.)
To Reproduce
To reproduce:
- Use Vapor FileMiddleware with directory action .redirect.
- Serve files through file middleware.
- Make getRequest without trailing "/" and add query parameters GET /Utilities?test=test.
Steps to reproduce the behavior:
- Add package with configuration '...'
- Send request with options '...'
- See error
Expected behavior
GET /Utilities?test=test -> 301 Moved Permanently /Utilities/?test=test (Query parameters persist)
Environment
- Vapor Framework version: framework: 4.78.2
- Vapor Toolbox version: toolbox: 18.7.1
- OS version: MacOS Ventura Version 13.6
Additional context
Add any other context about the problem here.
Captain-Kirkie commented
Pull request Here