Skip to content

armgit / zulip

Public Imported from GitHub
0

Zulip server and web application. Open-source team chat that helps teams stay productive and focused.

s3: Support setting a cache-control on uploads.

Alex Vandiverfeca9939bb44
diff --git a/zerver/lib/upload/s3.py b/zerver/lib/upload/s3.py
index 1adcaa889f1..113c29c48ca 100644
--- a/zerver/lib/upload/s3.py
+++ b/zerver/lib/upload/s3.py
@@ -74,6 +74,7 @@ def upload_image_to_s3(
"STANDARD",
"STANDARD_IA",
] = "STANDARD",
+ cache_control: Optional[str] = None,
) -> None:
key = bucket.Object(file_name)
metadata = {
@@ -86,6 +87,8 @@ def upload_image_to_s3(
content_type = ""
if content_type not in INLINE_MIME_TYPES:
extras["ContentDisposition"] = "attachment"
+ if cache_control is not None:
+ extras["CacheControl"] = cache_control
key.put(
Body=contents,