Skip to content

Fix base_url query parameters corrupted during URL merging#3766

Open
Fridayai700 wants to merge 1 commit intoencode:masterfrom
Fridayai700:fix-base-url-query-corruption
Open

Fix base_url query parameters corrupted during URL merging#3766
Fridayai700 wants to merge 1 commit intoencode:masterfrom
Fridayai700:fix-base-url-query-corruption

Conversation

@Fridayai700
Copy link

Summary

  • Fix _enforce_trailing_slash() appending / after query string in raw_path, corrupting ?data=1 into ?data=1/
  • Fix _merge_url() concatenating paths without separating query string from path component
  • Both methods now split raw_path at ? before path manipulation, then rejoin with query intact

Fixes #3614

Test plan

  • Added test_merge_url_with_base_url_query_params covering empty merge path and subpath merge
  • All existing merge URL tests pass (7/7)

When base_url contains query parameters (e.g. "https://example.com/get?data=1"),
_enforce_trailing_slash() appended "/" to raw_path which includes the query string,
corrupting "?data=1" into "?data=1/". Similarly, _merge_url() concatenated paths
without separating the query string from the path component.

Fix both methods to split raw_path at "?" before manipulating the path, then
rejoin with the query string intact.

Fixes encode#3614

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Corruption of query parameter value when using base_url with query string

1 participant

Comments