Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion src/sentry/api/endpoints/release_file_details.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
from __future__ import absolute_import
import posixpath

from rest_framework import serializers
from rest_framework.response import Response
Expand Down Expand Up @@ -79,7 +80,7 @@ def download(self, releasefile):
content_type=file.headers.get('content-type', 'application/octet-stream'),
)
response['Content-Length'] = file.size
response['Content-Disposition'] = "attachment; filename=%s" % releasefile.name
response['Content-Disposition'] = 'attachment; filename="%s"' % posixpath.basename(releasefile.name)
return response

@attach_scenarios([retrieve_file_scenario])
Expand Down
2 changes: 1 addition & 1 deletion tests/sentry/api/endpoints/test_release_file_details.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ def test_file_download(self):

response = self.client.get(url + '?download=1')
assert response.status_code == 200, response.content
assert response.get('Content-Disposition') == "attachment; filename=http://example.com/application.js"
assert response.get('Content-Disposition') == 'attachment; filename="application.js"'
assert response.get('Content-Length') == six.text_type(f.size)
assert response.get('Content-Type') == 'application/octet-stream'
assert 'File contents here' == BytesIO(b"".join(response.streaming_content)).getvalue()
Expand Down