Skip to content

Commit

Permalink
Replace escape/unescape with {en,de}codeURIComponent
Browse files Browse the repository at this point in the history
  • Loading branch information
mifi authored and mhart committed Apr 7, 2018
1 parent 24cf205 commit b460bec
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions aws4.js
Original file line number Diff line number Diff line change
Expand Up @@ -233,8 +233,8 @@ RequestSigner.prototype.canonicalString = function() {
if (normalizePath && piece === '..') {
path.pop()
} else if (!normalizePath || piece !== '.') {
if (decodePath) piece = querystring.unescape(piece)
path.push(encodeRfc3986(querystring.escape(piece)))
if (decodePath) piece = decodeURIComponent(piece)
path.push(encodeRfc3986(encodeURIComponent(piece)))
}
return path
}, []).join('/')
Expand Down Expand Up @@ -303,7 +303,7 @@ RequestSigner.prototype.parsePath = function() {
// So if there are non-reserved chars (and it's not already all % encoded), just encode them all
if (/[^0-9A-Za-z!'()*\-._~%/]/.test(path)) {
path = path.split('/').map(function(piece) {
return querystring.escape(querystring.unescape(piece))
return encodeURIComponent(decodeURIComponent(piece))
}).join('/')
}

Expand Down

0 comments on commit b460bec

Please sign in to comment.