Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix azure artifacts path download #1137

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
9 changes: 5 additions & 4 deletions pulpcore/content/handler.py
Expand Up @@ -594,15 +594,16 @@ def _serve_content_artifact(self, content_artifact, headers):
if settings.DEFAULT_FILE_STORAGE == "pulpcore.app.models.storage.FileSystem":
filename = content_artifact.artifact.file.name
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"
):
elif settings.DEFAULT_FILE_STORAGE == "storages.backends.s3boto3.S3Boto3Storage":
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)
elif settings.DEFAULT_FILE_STORAGE == "storages.backends.azure_storage.AzureStorage":
artifact_file = content_artifact.artifact.file
url = artifact_file.storage.url(artifact_file.name)
raise HTTPFound(url)
else:
raise NotImplementedError()

Expand Down
2 changes: 1 addition & 1 deletion requirements.txt
Expand Up @@ -14,7 +14,7 @@ djangorestframework~=3.12.2
djangorestframework-queryfields~=1.0.0
drf-access-policy~=0.8.6
drf-nested-routers==0.92.1
drf-spectacular==0.11.0
drf-spectacular==0.13.2
dynaconf~=3.1.2
gunicorn>=19.9,<20.1
jinja2
Expand Down