From de8fa9d94d7e99dda1c65b81a108414313900af1 Mon Sep 17 00:00:00 2001 From: Elias Hernandis Date: Fri, 27 Dec 2024 09:28:44 +0100 Subject: [PATCH] handle null-ish arguments in template tags --- anchor/templatetags/anchor.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/anchor/templatetags/anchor.py b/anchor/templatetags/anchor.py index 152ab42..167d91a 100644 --- a/anchor/templatetags/anchor.py +++ b/anchor/templatetags/anchor.py @@ -19,7 +19,7 @@ def blob_url(value: Blob | Attachment | None): """ Return a signed URL for the given Attachment or Blob. """ - if value is None: + if value is None or value == "": return "" return reverse( @@ -33,7 +33,7 @@ def representation_url(value: Variant | Blob | Attachment | None, **transformati """ Return a signed URL for a transformation of the given Attachment or Blob. """ - if value is None: + if value is None or value == "": return "" if isinstance(value, Variant):