From faedbc7d13b4fc3df9053b455110a40fad21f91f Mon Sep 17 00:00:00 2001 From: paulmwatson Date: Tue, 20 Aug 2024 11:52:18 +0200 Subject: [PATCH] return [] if exception when getting version file bytes size --- pmg/models/resources.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/pmg/models/resources.py b/pmg/models/resources.py index a4f3df82..c2d5a0bc 100644 --- a/pmg/models/resources.py +++ b/pmg/models/resources.py @@ -187,7 +187,10 @@ def latest_version_for_indexing(self): if not version: # don't return None return [] - return base64.encodestring(version.file.get_bytes()) + try: + return base64.encodestring(version.file.get_bytes()) + except AttributeError as e: + return [] def to_dict(self, include_related=False): tmp = serializers.model_to_dict(self, include_related=include_related)