From a9f61cc3f7801741bc6d5e077437f223b9b16c10 Mon Sep 17 00:00:00 2001 From: Ina Panova Date: Wed, 19 Jan 2022 20:15:20 +0100 Subject: [PATCH] Fixed content retrieval from distribution when repo is removed. closes #513 --- CHANGES/513.bugfix | 1 + pulp_container/app/registry.py | 4 ++++ 2 files changed, 5 insertions(+) create mode 100644 CHANGES/513.bugfix diff --git a/CHANGES/513.bugfix b/CHANGES/513.bugfix new file mode 100644 index 000000000..de82166eb --- /dev/null +++ b/CHANGES/513.bugfix @@ -0,0 +1 @@ +Fixed content retrieval from distribution when repo is removed. diff --git a/pulp_container/app/registry.py b/pulp_container/app/registry.py index d7e9a7a4d..ebfef1707 100644 --- a/pulp_container/app/registry.py +++ b/pulp_container/app/registry.py @@ -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: @@ -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: