Browse Source

Fix get_rendition erro

Jeremy Childers 1 year ago
parent
commit
626f5adb52
1 changed files with 10 additions and 3 deletions
  1. 10 3
      coderedcms/views.py

+ 10 - 3
coderedcms/views.py

@@ -128,9 +128,16 @@ def serve_protected_file(request, path):
 def favicon(request):
     icon = LayoutSettings.for_request(request).favicon
     if icon:
-        return HttpResponsePermanentRedirect(
-            icon.get_rendition("fill-256x256|format-webp|preserve-svg").url
-        )
+        # Try to convert to webp, otherwise pass original file format
+        # This will happen mainly if the file is an SVG
+        try:
+            return HttpResponsePermanentRedirect(
+                icon.get_rendition("fill-256x256|format-webp").url
+            )
+        except AttributeError:
+            return HttpResponsePermanentRedirect(
+                icon.get_rendition("fill-256x256").url
+            )
     raise Http404()