Skip to content

Commit

Permalink
Fixed content retrieval from distribution when repo is removed.
Browse files Browse the repository at this point in the history
closes #513
  • Loading branch information
ipanova committed Jan 21, 2022
1 parent e0ea4c7 commit a9f61cc
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
1 change: 1 addition & 0 deletions CHANGES/513.bugfix
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Fixed content retrieval from distribution when repo is removed.
4 changes: 4 additions & 0 deletions pulp_container/app/registry.py
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,8 @@ async def get_tag(self, request):
distribution = await sync_to_async(self._match_distribution)(path)
await sync_to_async(self._permit)(request, distribution)
repository_version = await sync_to_async(distribution.get_repository_version)()
if not repository_version:
raise PathNotResolved(tag_name)
accepted_media_types = get_accepted_media_types(request.headers)

try:
Expand Down Expand Up @@ -211,6 +213,8 @@ async def get_by_digest(self, request):
distribution = await sync_to_async(self._match_distribution)(path)
await sync_to_async(self._permit)(request, distribution)
repository_version = await sync_to_async(distribution.get_repository_version)()
if not repository_version:
raise PathNotResolved(path)
if digest == EMPTY_BLOB:
return await Registry._empty_blob()
try:
Expand Down

0 comments on commit a9f61cc

Please sign in to comment.