From c698c730a10c08fde992fdc12bc1c2fab329957b Mon Sep 17 00:00:00 2001 From: William Moore Date: Thu, 3 Oct 2024 15:19:39 +0100 Subject: [PATCH] fix return of default favicon if not found --- omero_mapr/views.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/omero_mapr/views.py b/omero_mapr/views.py index 072addc0..147f6872 100644 --- a/omero_mapr/views.py +++ b/omero_mapr/views.py @@ -673,10 +673,11 @@ def mapannotations_favicon(request, conn=None, **kwargs): cache.hset('favdomain', _cache_key, icon) finally: r.connection.close() - return HttpJPEGResponse(icon) + if icon is not None: + return HttpJPEGResponse(icon) with Image.open(mapr_settings.DEFAULT_FAVICON) as img: - img.thumbnail((16, 16), Image.ANTIALIAS) + img.thumbnail((16, 16)) f = BytesIO() img.save(f, "PNG") f.seek(0)