summaryrefslogtreecommitdiffstats
path: root/core
diff options
context:
space:
mode:
Diffstat (limited to 'core')
-rw-r--r--core/uploads.py18
1 files changed, 17 insertions, 1 deletions
diff --git a/core/uploads.py b/core/uploads.py
index c83888c..41b6e94 100644
--- a/core/uploads.py
+++ b/core/uploads.py
@@ -2,6 +2,7 @@ import os
import secrets
from django.utils import timezone
+from storages.backends.gcloud import GoogleCloudStorage
from storages.backends.s3boto3 import S3Boto3Storage
@@ -16,11 +17,26 @@ def upload_namer(prefix, instance, filename):
class TakaheS3Storage(S3Boto3Storage):
+ """
+ Custom override backend that makes webp files store correctly
+ """
+
def get_object_parameters(self, name: str):
params = self.object_parameters.copy()
-
if name.endswith(".webp"):
params["ContentDisposition"] = "inline"
params["ContentType"] = "image/webp"
+ return params
+
+class TakaheGoogleCloudStorage(GoogleCloudStorage):
+ """
+ Custom override backend that makes webp files store correctly
+ """
+
+ def get_object_parameters(self, name: str):
+ params = self.object_parameters.copy()
+ if name.endswith(".webp"):
+ params["content_disposition"] = "inline"
+ params["content_type"] = "image/webp"
return params