Skip to content

Commit

Permalink
Fixed image resolution for familiar references
Browse files Browse the repository at this point in the history
  • Loading branch information
kristiyank committed Aug 19, 2022
1 parent 4318bdb commit 4001ff0
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
5 changes: 4 additions & 1 deletion docker_registry_client_async/imagename.py
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,10 @@ def resolve_image(self) -> str:
Returns:
The explicit name of the image, with namespace.
"""
if "/" not in self.image:
if (
"/" not in self.image
and self.resolve_endpoint() == ImageName.DEFAULT_ENDPOINT
):
return f"{ImageName.DEFAULT_NAMESPACE}/{self.image}"

return self.image
Expand Down
3 changes: 2 additions & 1 deletion tests/test_imagename.py
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,8 @@ def test_resolve_image(image_data: TypingGetTestData):
"""Test image resolution."""
expected = (
image_data.image
if "/" in image_data.image
if ("/" in image_data.image
or image_data.endpoint not in (ImageName.DEFAULT_ENDPOINT, None))
else f"{ImageName.DEFAULT_NAMESPACE}/{image_data.image}"
)
assert image_data.object.resolve_image() == expected
Expand Down

0 comments on commit 4001ff0

Please sign in to comment.