- Notifications
You must be signed in to change notification settings - Fork676
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
Uh oh!
There was an error while loading.Please reload this page.
Changes fromall commits
File filter
Filter by extension
Conversations
Uh oh!
There was an error while loading.Please reload this page.
Jump to
Uh oh!
There was an error while loading.Please reload this page.
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -20,6 +20,7 @@ | ||
import re | ||
import time | ||
from typing import Any, cast, Dict, List, Optional, Tuple, TYPE_CHECKING, Union | ||
from urllib import parse | ||
import requests | ||
import requests.utils | ||
@@ -677,11 +678,15 @@ def http_request( | ||
GitlabHttpError: When the return code is not 2xx | ||
""" | ||
query_data = query_data or {} | ||
raw_url = self._build_url(path) | ||
# parse user-provided URL params to ensure we don't add our own duplicates | ||
parsed = parse.urlparse(raw_url) | ||
params = parse.parse_qs(parsed.query) | ||
utils.copy_dict(src=query_data, dest=params) | ||
url = raw_url.replace(parsed.query, "").strip("?") | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others.Learn more. Why not use
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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 ( Member
| ||
# Deal with kwargs: by default a user uses kwargs to send data to the | ||
# gitlab server, but this generates problems (python keyword conflicts | ||
# and python-gitlab/gitlab conflicts). | ||