From 6d1b62d4b248c4c021a59cd234c3a2b19e6fad07 Mon Sep 17 00:00:00 2001 From: "John L. Villalovos" Date: Thu, 4 Aug 2022 08:20:26 -0700 Subject: [PATCH] chore: use `urlunparse` instead of string replace Use the `urlunparse()` function to reconstruct the URL without the query parameters. --- gitlab/client.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gitlab/client.py b/gitlab/client.py index b3223e5cf..e3290e145 100644 --- a/gitlab/client.py +++ b/gitlab/client.py @@ -685,7 +685,7 @@ def http_request( params = parse.parse_qs(parsed.query) utils.copy_dict(src=query_data, dest=params) - url = raw_url.replace(parsed.query, "").strip("?") + url = parse.urlunparse(parsed._replace(query="")) # Deal with kwargs: by default a user uses kwargs to send data to the # gitlab server, but this generates problems (python keyword conflicts