Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

fix(client): ensure encoded query params are never duplicated#2219

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
max-wittig merged 2 commits intomainfromfix/no-duplicate-params
Aug 4, 2022

Conversation

nejch
Copy link
Member

@nejchnejch commentedAug 4, 2022
edited
Loading

Closes#2218

This provides a small generic fix at the http_request level instead of messing even more with our own flows.

(I've always thought it was a bit weird that GitLab returns a lot of boilerplate query params in thernext header links, so I think this will also make other things more robust in the future).

@nejchnejch changed the titletest(unit): reproduce duplicate encoded query paramsfix(client): ensure encoded query params are never duplicatedAug 4, 2022
@nejchnejch marked this pull request as ready for reviewAugust 4, 2022 13:54
@max-wittigmax-wittig merged commitd263f57 intomainAug 4, 2022
@max-wittigmax-wittig deleted the fix/no-duplicate-params branchAugust 4, 2022 14:36
utils.copy_dict(src=query_data, dest=params)

url = raw_url.replace(parsed.query, "").strip("?")

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Why not useparse.urlunparse?

url = parse.urlunparse(parsed._replace(query=""))

Copy link
MemberAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

I saw that on stackoverflow as well but it uses a private method (_replace) so didn't want to touch that 😁

JohnVillalovos reacted with laugh emoji
Copy link
Member

@JohnVillalovosJohnVillalovosAug 4, 2022
edited
Loading

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Oh it is documented in the official docs:

https://docs.python.org/3/library/urllib.parse.html

As is the case with all named tuples, the subclass has a few additional methods and attributes that are particularly useful. One such method is _replace(). The _replace() method will return a new ParseResult object replacing specified fields with new values.

Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers

@JohnVillalovosJohnVillalovosJohnVillalovos left review comments

Labels
None yet
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

URL-encoded kwargs are infinitely duplicated in query params (v3.7.0 regression for arrays)
3 participants
@nejch@JohnVillalovos@max-wittig

[8]ページ先頭

©2009-2025 Movatter.jp