expand S3 objects content type for better preview results in non-latin languages

pull/311/head
msramalho 2025-06-04 11:53:41 +01:00
rodzic d130c1b3fa
commit 378b1a6d22
Nie znaleziono w bazie danych klucza dla tego podpisu
1 zmienionych plików z 2 dodań i 0 usunięć

Wyświetl plik

@ -40,6 +40,8 @@ class S3Storage(Storage):
try:
if media.mimetype:
extra_args["ContentType"] = media.mimetype
if "text" in media.mimetype:
extra_args["ContentType"] += "; charset=utf-8"
except Exception as e:
logger.warning(f"Unable to get mimetype for {media.key=}, error: {e}")
self.s3.upload_fileobj(file, Bucket=self.bucket, Key=media.key, ExtraArgs=extra_args)