Skip to content

Commit

Permalink
Provide workaround to specify "correct" content_type for JSON files i…
Browse files Browse the repository at this point in the history
…n "inline" mode

Closes #2027
  • Loading branch information
yarikoptic committed Sep 20, 2024
1 parent 117b7ef commit 17eeae3
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions dandiapi/api/views/asset.py
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,11 @@ def download(self, request, *args, **kwargs):
storage.generate_presigned_download_url(asset_blob.blob.name, asset_basename)
)
if content_disposition == 'inline':
# Client might have not correctly identified/provided the content type which
# now forbids correct handling of the file in the browser.
if asset_basename.endswith('.json') and content_type == 'application/octet-stream':
content_type = 'application/json'

url = storage.generate_presigned_inline_url(
asset_blob.blob.name,
asset_basename,
Expand Down

0 comments on commit 17eeae3

Please sign in to comment.