Skip to content
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

trurl: "normalize" query pairs #328

Merged
merged 1 commit into from
Aug 27, 2024
Merged

trurl: "normalize" query pairs #328

merged 1 commit into from
Aug 27, 2024

Conversation

bagder
Copy link
Member

@bagder bagder commented Aug 26, 2024

To properly handle https://example.com/?%611&a2&a3 --trim query=a*, trurl now "normalizes" the query pairs by an extra round of URL decode + encode.

If a query pair gets normalized, consider it modified which in turn triggers a URL update. Thus

trurl 'https://example.com/?%611&a2&a3'

outputs

https://example.com/?a1&a2&a3

The query part URL encodes spaces to pluses (and vice versa). Note that %20 in the query in the input URL will be normalized to a +.

Updated several tests accordingly.

Reported-by: Emanuele Torre
Fixes #326

To properly handle https://example.com/?%611&a2&a3 --trim query=a*,
trurl now "normalizes" the query pairs by an extra round of URL decode +
encode.

If a query pair gets normalized, consider it modified which in turn
triggers a URL update. Thus

  trurl 'https://example.com/?%611&a2&a3'

outputs

  https://example.com/?a1&a2&a3

The query part URL encodes spaces to pluses (and vice versa). Note that
%20 in the query in the input URL will be normalized to a +.

Updated several tests accordingly.

Reported-by: Emanuele Torre
Fixes #326
Closes #328
@bagder bagder force-pushed the bagder/normalize-queries branch from de39ac2 to 520f988 Compare August 27, 2024 05:54
@bagder bagder merged commit caaec33 into master Aug 27, 2024
11 checks passed
@bagder bagder deleted the bagder/normalize-queries branch August 27, 2024 06:01
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.

--trim checks query keys literally ignoring URL encoding
1 participant