URI-encoded path parameters get broken
See original GitHub issueHi,
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
``
if (openapi?.pathParams) {
const { pathParams } = openapi;
// override path params
req.params[name] = pathParams[name] || req.params[name];
}
``
Issue Analytics
- State:
- Created 4 years ago
- Comments:7 (5 by maintainers)
Top Results From Across the Web
broken auto-decoding urlencoded named path parameters #878
Param("s") don't decode param if it encoded with urlencode Steps to reproduce ... broken auto-decoding urlencoded named path parameters #878.
Read more >Java URL encoding of query string parameters - Stack Overflow
I have used URI.create and replaced spaces with + in querystring. At the client site it converted + back to spaces when I...
Read more >API using url encoded paths is broken (#18775) - GitLab.org
It seems like you have to have some additional settings in the NGINX config to allow the encoded params to pass. Is the...
Read more >encodeURIComponent() - JavaScript - MDN Web Docs
A string to be encoded as a URI component (a path, query string, fragment, etc.). Other values are converted to strings.
Read more >parse_url - Manual - PHP
This function parses a URL and returns an associative array containing any of the various components of the URL that are present. The...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@cdimascio Thank you very much. It works well now.
@TorstenForth i had a look at this issue. it should be resolved now. see
v3.9.4
. let me know how it goes. thanks!