s3: Stop setting empty Content-Disposition header.

This commit is contained in:
Alex Vandiver
2024-06-28 23:44:30 +00:00
committed by Tim Abbott
parent 54be4443ae
commit 6258817bfd

View File

@@ -81,18 +81,18 @@ def upload_image_to_s3(
"realm_id": str(user_profile.realm_id),
}
content_disposition = ""
extras = {}
if content_type is None:
content_type = ""
if content_type not in INLINE_MIME_TYPES:
content_disposition = "attachment"
extras["ContentDisposition"] = "attachment"
key.put(
Body=contents,
Metadata=metadata,
ContentType=content_type,
ContentDisposition=content_disposition,
StorageClass=storage_class,
**extras, # type: ignore[arg-type] # The dynamic kwargs here confuse mypy.
)