| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
Path parameters containing reserved characters (/, ?, &, #, spaces, etc.) were being inserted directly into URLs without encoding, causing malformed requests and potential security issues. Changes: - Import urllib.parse.quote in endpoint template - Wrap all path parameters with quote(str(...), safe="") to ensure proper encoding - Add comprehensive tests for various special characters in path parameters This ensures that path parameters are properly percent-encoded according to RFC 3986, preventing URL parsing errors and security vulnerabilities. Fixes cases where path parameters contain: - Slashes (/) -> %2F - Question marks (?) -> %3F - Ampersands (&) -> %26 - Hash/fragments (#) -> %23 - Spaces -> %20 - And other reserved characters
There was a problem hiding this comment.
Seems like the right call, though I will mark as a breaking change since someone was probably relying on the previous unsafe behavior 😓.
Thanks!
Sorry, something went wrong.
> [!IMPORTANT] > Merging this pull request will create this release ## Breaking Changes - URL-encode path parameters in generated endpoints (#1349) ## Fixes ### Fix bad code generation #1360 by @EricAtORS This fixes: - missing parenthesis in to_multipart #1338 #1318 - missing imports in the lazy eval in to_multipart: #931 and #1051 ### Fix optional bodies If a body is not required (the default), it will now: 1. Have `Unset` as part of its type annotation. 2. Default to a value of `UNSET` 3. Not be included in the request if it is `UNSET` Thanks @orelmaliach for the report! Fixes #1354 Co-authored-by: knope-bot[bot] <152252888+knope-bot[bot]@users.noreply.github.com>
| Back | FazBrowse Home | New Git URL |
Summary
Path parameters containing reserved characters were being inserted directly into URLs without encoding, causing malformed requests and potential security issues.
Problem
When path parameters contain special characters like:
These were not being URL-encoded, leading to:
Solution
Changes
Test plan
Example
Before:
After: