index & s3: handle some url encoding mess

This commit is contained in:
Peter Cai 2020-02-18 17:58:43 +08:00
parent 0f664d3890
commit 24b07f3d95
No known key found for this signature in database
GPG Key ID: 71F5FB4E4F3FD54F
2 changed files with 3 additions and 2 deletions

View File

@ -77,7 +77,8 @@ class AwsAuth
@headerMap['x-amz-content-sha256']
canonicalURI: ->
encodeURI @url.pathname
# new URL already handles URI encoding for the pathname. No need to repeat here.
@url.pathname
canonicalQueryString: ->
return "" if not @qsMap

View File

@ -113,7 +113,7 @@ handleGET = (req, file) ->
# Add content-disposition header to indicate file name
inline = util.shouldShowInline headers['content-type']
headers['content-disposition'] =
(if inline then 'inline;' else 'attachment;') + ' filename=' + fileName
(if inline then 'inline;' else 'attachment;') + ' filename*=' + encodeURIComponent fileName
# Handle ranged resposes
if resp.headers.has 'content-range'