-
-
Notifications
You must be signed in to change notification settings - Fork 219
URI-encoded path parameters get broken #256
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
Comments
@TorstenForth thanks for the issue. perhaps the validator (like express) must also decode the path param prior to overriding it. is this effectively what you are suggesting? also if you feel so inclined, feel free to make the change and submit a PR. i'm happy to review |
@cdimascio Thanks for the quick reply. Decoding the path params would work for me. I'm not familiar with the internals of the validator. Why are the parameters actually overwritten? Is it ok to change line 140 to I tried to push a branch with the fix for the pull request but I gut a 'Permission denied' error. |
Sure, please give that a try. If all To create the PR
Detailed steps with example here: (I'll add this process to CONTRIBUTING.md as other have also asked) it's done to keep the params synced with the spec schema, code |
Also, if you don't, please provide the relevant aspects of your spec, your express handler function, and the http call you are making. this will help me to repro |
If your change does not work, another thing to try might be to modify something like const paramsVals = matchedRoute.slice(1).map(decodeURIComponent); |
decode urlencoded path parameters #256
@TorstenForth i had a look at this issue. it should be resolved now. see |
@cdimascio Thank you very much. It works well now. |
decode urlencoded path parameters #256
Hi,
I submit a string containing the '/' character with Swagger UI in the browser (as a path parameter).
When I receive the string in req.params, the string contains the URI-encoded '%2F'.
I was debugging into the source code and found out that the req.params (which are URI-decoded by Express) are overwritten with the original (not URI-decoded) values.
The params are overwritten in the file src/index.ts, line 140 of Commit 00273f7
``
``
The text was updated successfully, but these errors were encountered: