Skip to content

fix(string): compare full URL parameter names - #2774

Merged
keon merged 2 commits into
keon:mainfrom
Miladkhoshdel:fix/strip-url-params2-key-comparison
Sep 25, 2026
Merged

keon merged 2 commits into
keon:mainfrom
Miladkhoshdel:fix/strip-url-params2-key-comparison

Conversation

@Miladkhoshdel

Copy link
Copy Markdown
Contributor

Problem

strip_url_params2 used only the first character of each query parameter as its key. Different parameters with the same first letter were therefore treated as duplicates.

For example:

strip_url_params2("https://x.test?ab=1&ac=2&ab=3")

Previously returned https://x.test?ab=1, incorrectly dropping ac. The expected result is https://x.test?ab=1&ac=2: ab appears twice, but ac is a separate parameter.

The previous loop also skipped the first parameter when applying param_to_strip.

Changes

  • Extract the full parameter name before = for duplicate checks.
  • Keep the first occurrence of each parameter, in its original order.
  • Apply param_to_strip to every parameter, including the first.

Tests

Added regression cases for distinct names with a shared first letter, repeated multi-character names, and removal of the first parameter.

Ran python3 -m unittest discover -s tests -p test_string.py — all 68 tests passed.

Fixes #2773

@keon
keon merged commit bd1d152 into keon:main Sep 25, 2026
4 checks passed
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.

strip_url_params2 removes distinct query parameters with the same first letter

2 participants