Skip to content

URL-encoded kwargs are infinitely duplicated in query params (v3.7.0 regression for arrays) #2218

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

Closed
nejch opened this issue Aug 4, 2022 · 1 comment · Fixed by #2219
Closed
Assignees
Labels

Comments

@nejch
Copy link
Member

nejch commented Aug 4, 2022

Description of the problem, including code/CLI snippet

With #1699 we added array params for query params in GET requests. But GitLab also returns that param, URL-encoded, in the next URL which we then follow in listing endpoints. Because one is URL-encoded and the other isn't, the param gets added at the end of the query again. With list() calls this happens over and over again and causes 502 due to super long query strings eventually.

minimal reproduction:

import gitlab

gl = gitlab.Gitlab()
gl.enable_debug()

projects = gl.projects.list(topics=["python"], per_page=1, iterator=True)

for project in projects:
    # watch the `send` URL grow continuously until triggering 502
    pass

Expected Behavior

If a kwarg/param (URL-encoded or not) that we provide is already in the provided URL, it should never be duplicated when we construct the final request URL.

Actual Behavior

http_request() and requests can't tell if our kwargs match those already in the URL params and they get duplicated to oblivion, causing 502 once the URL query is too long for the server.

Specifications

  • python-gitlab version: v3.7.0
  • API version you are using (v3/v4): v4
  • Gitlab server version (or gitlab.com): all
@JohnVillalovos
Copy link
Member

Wow! 😲

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Aug 7, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants