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

respect content-disposition response header field if provided #129

Open
yarikoptic opened this issue Aug 20, 2021 · 0 comments
Open

respect content-disposition response header field if provided #129

yarikoptic opened this issue Aug 20, 2021 · 0 comments

Comments

@yarikoptic
Copy link
Contributor

An example for dandiarchive URL
$> wget -S https://api.dandiarchive.org/api/assets/db080212-f712-4f09-b3b6-b39554cdd74e/download/  
--2021-08-20 16:36:26--  https://api.dandiarchive.org/api/assets/db080212-f712-4f09-b3b6-b39554cdd74e/download/
Resolving api.dandiarchive.org (api.dandiarchive.org)... 54.162.128.250, 18.205.36.100, 54.157.58.70, ...
Connecting to api.dandiarchive.org (api.dandiarchive.org)|54.162.128.250|:443... connected.
HTTP request sent, awaiting response... 
  HTTP/1.1 302 Found
  Connection: keep-alive
  Server: gunicorn
  Date: Fri, 20 Aug 2021 20:36:26 GMT
  Content-Type: text/html; charset=utf-8
  Location: https://dandiarchive.s3.amazonaws.com/blobs/74f/474/74f47415-04df-4b9c-9343-5e9a949dd5ba?response-content-disposition=attachment%3B%20filename%3D%22sub-MITU01_ses-MR_T1map.nii.gz%22&X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=AKIAUBRWC5GAEKH3223E%2F20210820%2Fus-east-2%2Fs3%2Faws4_request&X-Amz-Date=20210820T203626Z&X-Amz-Expires=3600&X-Amz-SignedHeaders=host&X-Amz-Signature=8f8840df510bade887f4d22ea04fbcbd934e8b5262531c81f9754ed77eb4440c
  Vary: Accept, Cookie, Origin
  Allow: GET, HEAD, OPTIONS
  X-Frame-Options: DENY
  Content-Length: 0
  Strict-Transport-Security: max-age=31536000
  X-Content-Type-Options: nosniff
  Referrer-Policy: same-origin
  Via: 1.1 vegur
Location: https://dandiarchive.s3.amazonaws.com/blobs/74f/474/74f47415-04df-4b9c-9343-5e9a949dd5ba?response-content-disposition=attachment%3B%20filename%3D%22sub-MITU01_ses-MR_T1map.nii.gz%22&X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=AKIAUBRWC5GAEKH3223E%2F20210820%2Fus-east-2%2Fs3%2Faws4_request&X-Amz-Date=20210820T203626Z&X-Amz-Expires=3600&X-Amz-SignedHeaders=host&X-Amz-Signature=8f8840df510bade887f4d22ea04fbcbd934e8b5262531c81f9754ed77eb4440c [following]
--2021-08-20 16:36:26--  https://dandiarchive.s3.amazonaws.com/blobs/74f/474/74f47415-04df-4b9c-9343-5e9a949dd5ba?response-content-disposition=attachment%3B%20filename%3D%22sub-MITU01_ses-MR_T1map.nii.gz%22&X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=AKIAUBRWC5GAEKH3223E%2F20210820%2Fus-east-2%2Fs3%2Faws4_request&X-Amz-Date=20210820T203626Z&X-Amz-Expires=3600&X-Amz-SignedHeaders=host&X-Amz-Signature=8f8840df510bade887f4d22ea04fbcbd934e8b5262531c81f9754ed77eb4440c
Resolving dandiarchive.s3.amazonaws.com (dandiarchive.s3.amazonaws.com)... 52.219.98.68
Connecting to dandiarchive.s3.amazonaws.com (dandiarchive.s3.amazonaws.com)|52.219.98.68|:443... connected.
HTTP request sent, awaiting response... 
  HTTP/1.1 200 OK
  x-amz-id-2: GJzEXRY1dUyHx4Uvir9qcZJ93xnoi1/b2zbtR54CfEX08ZHMYidggWK2nF0r/z38YwxtagQwNZc=
  x-amz-request-id: HBD8RV2ZEB96D8XS
  Date: Fri, 20 Aug 2021 20:36:28 GMT
  Last-Modified: Thu, 20 May 2021 15:45:12 GMT
  ETag: "88fba545aeb0f44cfecd0c023a1e817e-28"
  x-amz-version-id: xh4VEcI5OY_nMWCO.4VuNLwEq.h.2F7C
  Content-Disposition: attachment; filename="sub-MITU01_ses-MR_T1map.nii.gz"
  Accept-Ranges: bytes
  Content-Type: binary/octet-stream
  Server: AmazonS3
  Content-Length: 1863940394
Length: 1863940394 (1.7G) [binary/octet-stream]
Saving to: ‘index.html.2’

index.html.2                                            0%[                                                                                                                          ] 781.51K  2.35MB/s             index.html.2                                            0%[     

you can see that in the response header there is

  Content-Disposition: attachment; filename="sub-MITU01_ses-MR_T1map.nii.gz"

relevant code path pointed to: https://github.com/bioimagesuiteweb/bisweb/blob/devel/js/core/bis_coregenericio.js#L590

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant