Skip to content

Commit

Permalink
Content app now properly sets Content-Type header for S3
Browse files Browse the repository at this point in the history
fixes: #9216
  • Loading branch information
gerrod3 authored and mdellweg committed Aug 16, 2021
1 parent d8fe016 commit feede7b
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 0 deletions.
1 change: 1 addition & 0 deletions CHANGES/9216.bugfix
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Content app now properly sets Content-Type header for artifacts being served from S3
2 changes: 2 additions & 0 deletions pulpcore/content/handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -788,6 +788,8 @@ async def _serve_content_artifact(self, content_artifact, headers):
elif settings.DEFAULT_FILE_STORAGE == "storages.backends.s3boto3.S3Boto3Storage":
content_disposition = f"attachment;filename={content_artifact.relative_path}"
parameters = {"ResponseContentDisposition": content_disposition}
if headers.get("Content-Type"):
parameters["ResponseContentType"] = headers.get("Content-Type")
url = URL(
artifact_file.storage.url(artifact_file.name, parameters=parameters), encoded=True
)
Expand Down

0 comments on commit feede7b

Please sign in to comment.