Comparing version 1.2.0 to 1.2.1
13
aws4.js
@@ -18,4 +18,5 @@ var aws4 = exports, | ||
function encodeRfc3986(string) { | ||
return querystring.escape(string).replace(/[!'()*]/g, function(c) { | ||
// This function assumes the string has already been percent encoded | ||
function encodeRfc3986(urlEncodedString) { | ||
return urlEncodedString.replace(/[!'()*]/g, function(c) { | ||
return '%' + c.charCodeAt(0).toString(16).toUpperCase() | ||
@@ -204,3 +205,3 @@ }) | ||
if (query) { | ||
queryStr = querystring.stringify(Object.keys(query).sort().reduce(function(obj, key) { | ||
queryStr = encodeRfc3986(querystring.stringify(Object.keys(query).sort().reduce(function(obj, key) { | ||
if (!key) return obj | ||
@@ -210,3 +211,3 @@ obj[key] = !Array.isArray(query[key]) ? query[key] : | ||
return obj | ||
}, {}), null, null, {encodeURIComponent: encodeRfc3986}) | ||
}, {}))) | ||
} | ||
@@ -221,3 +222,3 @@ if (pathStr !== '/') { | ||
if (decodePath) piece = querystring.unescape(piece) | ||
path.push(encodeRfc3986(piece)) | ||
path.push(encodeRfc3986(querystring.escape(piece))) | ||
} | ||
@@ -309,3 +310,3 @@ return path | ||
return path + '?' + querystring.stringify(query, null, null, {encodeURIComponent: encodeRfc3986}) | ||
return path + '?' + encodeRfc3986(querystring.stringify(query)) | ||
} | ||
@@ -312,0 +313,0 @@ |
{ | ||
"name": "aws4", | ||
"version": "1.2.0", | ||
"version": "1.2.1", | ||
"description": "Signs and prepares requests using AWS Signature Version 4", | ||
@@ -5,0 +5,0 @@ "author": "Michael Hart <michael.hart.au@gmail.com> (http://github.com/mhart)", |
Sorry, the diff of this file is not supported yet
38866
570