diff options
author | John L. Villalovos <john@sodarock.com> | 2022-01-08 16:10:27 -0800 |
---|---|---|
committer | John L. Villalovos <john@sodarock.com> | 2022-01-08 16:13:59 -0800 |
commit | 3d49e5e6a2bf1c9a883497acb73d7ce7115b804d (patch) | |
tree | d16d4dcdec97ea3afb09ef7403d784e288ede49f /gitlab/mixins.py | |
parent | 0dba899c20dda3a9789992a1186cfd718e5b588f (diff) | |
download | gitlab-3d49e5e6a2bf1c9a883497acb73d7ce7115b804d.tar.gz |
fix: remove custom URL encoding
We were using `str.replace()` calls to take care of URL encoding
issues.
Switch them to use our `utils._url_encode()` function which itself uses
`urllib.parse.quote()`
Closes: #1356
Diffstat (limited to 'gitlab/mixins.py')
-rw-r--r-- | gitlab/mixins.py | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/gitlab/mixins.py b/gitlab/mixins.py index 1abffa1..c02f4c0 100644 --- a/gitlab/mixins.py +++ b/gitlab/mixins.py @@ -100,7 +100,7 @@ class GetMixin(_RestManagerBase): GitlabGetError: If the server cannot perform the request """ if not isinstance(id, int): - id = utils.clean_str_id(id) + id = utils._url_encode(id) path = f"{self.path}/{id}" if TYPE_CHECKING: assert self._obj_cls is not None @@ -444,7 +444,7 @@ class SetMixin(_RestManagerBase): Returns: The created/updated attribute """ - path = f"{self.path}/{utils.clean_str_id(key)}" + path = f"{self.path}/{utils._url_encode(key)}" data = {"value": value} server_data = self.gitlab.http_put(path, post_data=data, **kwargs) if TYPE_CHECKING: @@ -478,7 +478,7 @@ class DeleteMixin(_RestManagerBase): path = self.path else: if not isinstance(id, int): - id = utils.clean_str_id(id) + id = utils._url_encode(id) path = f"{self.path}/{id}" self.gitlab.http_delete(path, **kwargs) |