diff --git a/CHANGES/6154.bugfix b/CHANGES/6154.bugfix new file mode 100644 index 0000000000..8b44d30602 --- /dev/null +++ b/CHANGES/6154.bugfix @@ -0,0 +1 @@ +Fixing broken S3 redirect diff --git a/pulpcore/content/handler.py b/pulpcore/content/handler.py index 4f237778e5..6ce94e9333 100644 --- a/pulpcore/content/handler.py +++ b/pulpcore/content/handler.py @@ -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()