mirror of
https://github.com/paperless-ngx/paperless-ngx.git
synced 2025-07-30 18:27:45 -05:00
webp thumbnail support with png fallback
This commit is contained in:
@@ -362,7 +362,12 @@ class DocumentViewSet(
|
||||
handle = doc.thumbnail_file
|
||||
# TODO: Send ETag information and use that to send new thumbnails
|
||||
# if available
|
||||
return HttpResponse(handle, content_type="image/png")
|
||||
content_type = (
|
||||
"image/webp"
|
||||
if os.path.splitext(doc.thumbnail_path)[1] == ".webp"
|
||||
else "image/png"
|
||||
)
|
||||
return HttpResponse(handle, content_type=content_type)
|
||||
except (FileNotFoundError, Document.DoesNotExist):
|
||||
raise Http404()
|
||||
|
||||
|
Reference in New Issue
Block a user