From a3e2eeff488473411231bc154df918c0d68ca30e Mon Sep 17 00:00:00 2001 From: Dimas Ciputra Date: Fri, 6 Sep 2024 08:36:52 +0100 Subject: [PATCH] Check bad UUID when downloading csv (#4225) --- bims/serializers/bio_collection_serializer.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/bims/serializers/bio_collection_serializer.py b/bims/serializers/bio_collection_serializer.py index 995c99444..16acaf72d 100644 --- a/bims/serializers/bio_collection_serializer.py +++ b/bims/serializers/bio_collection_serializer.py @@ -265,7 +265,10 @@ def get_abundance_value(self, obj): def get_uuid(self, obj): if obj.uuid: - return str(uuid.UUID(obj.uuid)) + try: + return str(uuid.UUID(obj.uuid)) + except ValueError: + return obj.uuid return '-' def get_user_river_name(self, obj):