Skip to content

Commit 04c6063

Browse files
authored
Merge pull request #2117 from python-gitlab/jlvillal/encodedid_path
fix: ensure path elements are escaped
2 parents ca3b438 + 5d9c198 commit 04c6063

File tree

2 files changed

+7
-5
lines changed

2 files changed

+7
-5
lines changed

gitlab/base.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -380,10 +380,12 @@ def _compute_path(self, path: Optional[str] = None) -> Optional[str]:
380380
if self._parent is None or not self._from_parent_attrs:
381381
return path
382382

383-
data = {
384-
self_attr: getattr(self._parent, parent_attr, None)
385-
for self_attr, parent_attr in self._from_parent_attrs.items()
386-
}
383+
data: Dict[str, Optional[gitlab.utils.EncodedId]] = {}
384+
for self_attr, parent_attr in self._from_parent_attrs.items():
385+
if not hasattr(self._parent, parent_attr):
386+
data[self_attr] = None
387+
continue
388+
data[self_attr] = gitlab.utils.EncodedId(getattr(self._parent, parent_attr))
387389
self._parent_attrs = data
388390
return path.format(**data)
389391

tests/functional/conftest.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -391,7 +391,7 @@ def project_file(project):
391391
@pytest.fixture(scope="function")
392392
def release(project, project_file):
393393
_id = uuid.uuid4().hex
394-
name = f"test-release-{_id}"
394+
name = f"we_have_a_slash/test-release-{_id}"
395395

396396
project.refresh() # Gets us the current default branch
397397
release = project.releases.create(

0 commit comments

Comments
 (0)
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