Skip to content
Open
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
10 changes: 9 additions & 1 deletion ckanext/s3filestore/views/resource.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,15 @@ def resource_download(package_type, id, resource_id, filename=None):
'attachment; filename=' + filename,
}
url = upload.get_signed_url_to_key(key_path, params)
return redirect(url)

redir = redirect(url)
# remove Authorization header from redirect
# so that it doesn't get passed to S3
# (which doesn't like it)
redir.headers.pop('Authorization', None)
# remove Origin header because it causes problems with CORS on S3
redir.headers.pop('Origin', None)
return redir

except ClientError as ex:
if ex.response['Error']['Code'] in ['NoSuchKey', '404']:
Expand Down