From 5d9c198769b00c8e7661e62aaf5f930ed32ef829 Mon Sep 17 00:00:00 2001 From: "John L. Villalovos" Date: Sun, 3 Jul 2022 09:27:55 -0700 Subject: [PATCH] fix: ensure path elements are escaped Ensure the path elements that are passed to the server are escaped. For example a "/" will be changed to "%2F" Closes: #2116 --- gitlab/base.py | 10 ++++++---- tests/functional/conftest.py | 2 +- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/gitlab/base.py b/gitlab/base.py index 205a0f20e..76524d1c1 100644 --- a/gitlab/base.py +++ b/gitlab/base.py @@ -380,10 +380,12 @@ def _compute_path(self, path: Optional[str] = None) -> Optional[str]: if self._parent is None or not self._from_parent_attrs: return path - data = { - self_attr: getattr(self._parent, parent_attr, None) - for self_attr, parent_attr in self._from_parent_attrs.items() - } + data: Dict[str, Optional[gitlab.utils.EncodedId]] = {} + for self_attr, parent_attr in self._from_parent_attrs.items(): + if not hasattr(self._parent, parent_attr): + data[self_attr] = None + continue + data[self_attr] = gitlab.utils.EncodedId(getattr(self._parent, parent_attr)) self._parent_attrs = data return path.format(**data) diff --git a/tests/functional/conftest.py b/tests/functional/conftest.py index 09cdd6931..22457ba79 100644 --- a/tests/functional/conftest.py +++ b/tests/functional/conftest.py @@ -391,7 +391,7 @@ def project_file(project): @pytest.fixture(scope="function") def release(project, project_file): _id = uuid.uuid4().hex - name = f"test-release-{_id}" + name = f"we_have_a_slash/test-release-{_id}" project.refresh() # Gets us the current default branch release = project.releases.create( pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy