Skip to content

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

Closed
@nejch

Description

@nejch

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

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions