Skip to content

Commit

Permalink
parts.publish: Properly quote the root prefix ('.')
Browse files Browse the repository at this point in the history
Since Python3.5 the behavior of urllib changed, '/./' was previously
left untouched but now it is simplified to '/'. The aptly documentation
tell us to use ':.' instead of '.' because ". is ambigious in URLs".
  • Loading branch information
rsebille committed Oct 16, 2017
1 parent 4e35c9c commit 486429b
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
2 changes: 2 additions & 0 deletions aptly_api/parts/publish.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,8 @@ def endpoint_from_response(api_response: Union[Dict[str, str], Dict[str, List[st

@staticmethod
def escape_prefix(prefix: str) -> str:
if prefix == ".":
return ":."
if "/" in prefix:
# prefix has not yet been quoted as described at
# https://www.aptly.info/doc/api/publish/
Expand Down
4 changes: 4 additions & 0 deletions aptly_api/tests/publish.py
Original file line number Diff line number Diff line change
Expand Up @@ -281,3 +281,7 @@ def test_escape_prefix(self, *args: Any, **kwargs: Any) -> None:
self.papi.escape_prefix("test/a"),
"test_a"
)
self.assertEqual(
self.papi.escape_prefix("."),
":."
)

0 comments on commit 486429b

Please sign in to comment.