Skip to content

Commit

Permalink
Fixing broken S3 redirect
Browse files Browse the repository at this point in the history
  • Loading branch information
fao89 committed Feb 13, 2020
1 parent 9aac516 commit 3b917b4
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
1 change: 1 addition & 0 deletions CHANGES/6154.bugfix
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Fixing broken S3 redirect
10 changes: 5 additions & 5 deletions pulpcore/content/handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -554,11 +554,11 @@ def _serve_content_artifact(self, content_artifact, headers):
return FileResponse(os.path.join(settings.MEDIA_ROOT, filename), headers=headers)
elif (settings.DEFAULT_FILE_STORAGE == 'storages.backends.s3boto3.S3Boto3Storage' or
settings.DEFAULT_FILE_STORAGE == 'storages.backends.azure_storage.AzureStorage'):
filename_portion = '?response-content-disposition=attachment; filename={}'.format(
content_artifact.relative_path
)
url = content_artifact.artifact.file.url + filename_portion
raise HTTPFound(url, headers=headers)
artifact_file = content_artifact.artifact.file
content_disposition = f'attachment;filename={content_artifact.relative_path}'
parameters = {"ResponseContentDisposition": content_disposition}
url = artifact_file.storage.url(artifact_file.name, parameters=parameters)
raise HTTPFound(url)
else:
raise NotImplementedError()

Expand Down

0 comments on commit 3b917b4

Please sign in to comment.