mirror of
https://github.com/paperless-ngx/paperless-ngx.git
synced 2025-04-09 09:58:20 -05:00
Minor tweak to determining content type
This commit is contained in:
parent
12cdcf7681
commit
b50325c3a3
@ -362,11 +362,12 @@ class DocumentViewSet(
|
|||||||
handle = doc.thumbnail_file
|
handle = doc.thumbnail_file
|
||||||
# TODO: Send ETag information and use that to send new thumbnails
|
# TODO: Send ETag information and use that to send new thumbnails
|
||||||
# if available
|
# if available
|
||||||
content_type = (
|
thumbnail_path = doc.thumbnail_path
|
||||||
"image/webp"
|
if os.path.splitext(thumbnail_path)[1] == ".webp":
|
||||||
if os.path.splitext(doc.thumbnail_path)[1] == ".webp"
|
content_type = "image/webp"
|
||||||
else "image/png"
|
else:
|
||||||
)
|
content_type = "image/png"
|
||||||
|
|
||||||
return HttpResponse(handle, content_type=content_type)
|
return HttpResponse(handle, content_type=content_type)
|
||||||
except (FileNotFoundError, Document.DoesNotExist):
|
except (FileNotFoundError, Document.DoesNotExist):
|
||||||
raise Http404()
|
raise Http404()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user