mirror of
https://github.com/ae-utbm/sith.git
synced 2025-07-11 12:29:24 +00:00
convert uploaded images to webp
This commit is contained in:
@ -12,6 +12,7 @@
|
||||
# OR WITHIN THE LOCAL FILE "LICENSE"
|
||||
#
|
||||
#
|
||||
import mimetypes
|
||||
from urllib.parse import quote, urljoin
|
||||
|
||||
# This file contains all the views that concern the page model
|
||||
@ -77,7 +78,7 @@ def send_file(
|
||||
raise Http404
|
||||
with open(filepath, "rb") as filename:
|
||||
response.content = FileWrapper(filename)
|
||||
response["Content-Type"] = f.mime_type
|
||||
response["Content-Type"] = mimetypes.guess_type(filepath)[0]
|
||||
response["Last-Modified"] = http_date(f.date.timestamp())
|
||||
response["Content-Length"] = filepath.stat().st_size
|
||||
return response
|
||||
|
Reference in New Issue
Block a user