From 1161c726f8e05bcdfbbb4725506fff5a79c5b83c Mon Sep 17 00:00:00 2001 From: Gerrod Ubben Date: Fri, 10 May 2024 11:42:20 -0400 Subject: [PATCH] Fix content directory list 500 when RemoteArtifact had null size fixes: #5318 --- CHANGES/5318.bugfix | 1 + pulpcore/content/handler.py | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) create mode 100644 CHANGES/5318.bugfix diff --git a/CHANGES/5318.bugfix b/CHANGES/5318.bugfix new file mode 100644 index 0000000000..393578a7a7 --- /dev/null +++ b/CHANGES/5318.bugfix @@ -0,0 +1 @@ +Fixed content directory listing returning 500 in certain scenarios due to missing artifact sizes. diff --git a/pulpcore/content/handler.py b/pulpcore/content/handler.py index 8ee12d2f4a..3af78826de 100644 --- a/pulpcore/content/handler.py +++ b/pulpcore/content/handler.py @@ -515,7 +515,7 @@ def list_directory_blocking(): ) # Find the sizes for on_demand artifacts r_artifacts = RemoteArtifact.objects.filter( - content_artifact__in=artifacts_to_find.keys() + content_artifact__in=artifacts_to_find.keys(), size__isnull=False ).values_list("content_artifact_id", "size") sizes.update({artifacts_to_find[ra_ca_id]: size for ra_ca_id, size in r_artifacts})