]> git.ipfire.org Git - thirdparty/paperless-ngx.git/commitdiff
Minor tweak to determining content type
authorTrenton Holmes <holmes.trenton@gmail.com>
Fri, 10 Jun 2022 15:57:36 +0000 (08:57 -0700)
committerTrenton Holmes <holmes.trenton@gmail.com>
Fri, 10 Jun 2022 15:57:36 +0000 (08:57 -0700)
src/documents/views.py

index 1e9583bc52576462bdcbaff74b4a81ad8a33500f..bcd2958f8a9fcf84329ca9e22fde815e93fb3ee8 100644 (file)
@@ -362,11 +362,12 @@ class DocumentViewSet(
                 handle = doc.thumbnail_file
             # TODO: Send ETag information and use that to send new thumbnails
             #  if available
-            content_type = (
-                "image/webp"
-                if os.path.splitext(doc.thumbnail_path)[1] == ".webp"
-                else "image/png"
-            )
+            thumbnail_path = doc.thumbnail_path
+            if os.path.splitext(thumbnail_path)[1] == ".webp":
+                content_type = "image/webp"
+            else:
+                content_type = "image/png"
+
             return HttpResponse(handle, content_type=content_type)
         except (FileNotFoundError, Document.DoesNotExist):
             raise Http404()