Comparing version 1.0.1 to 1.0.2
@@ -138,7 +138,15 @@ 'use strict'; | ||
this.encodedPath = | ||
this.service === 's3' ? decodeURIComponent(this.url.pathname) : this.url.pathname.replace(/\/+/g, '/'); | ||
if (this.service === 's3') { | ||
try { | ||
this.encodedPath = decodeURIComponent(this.url.pathname).replace(/\+/g, ' '); | ||
} catch (e) { | ||
this.encodedPath = this.url.pathname; | ||
} | ||
} else { | ||
this.encodedPath = this.url.pathname.replace(/\/+/g, '/'); | ||
} | ||
if (!singleEncode) { | ||
this.encodedPath = encodeURIComponent(this.encodedPath).replace(/%2F/g, '/'); | ||
} | ||
this.encodedPath = encodeRfc3986(this.encodedPath); | ||
@@ -155,3 +163,3 @@ const seenKeys = new Set(); | ||
}) | ||
.map(pair => pair.map(encodeURIComponent).join('=')) | ||
.map(pair => pair.map(p => encodeRfc3986(encodeURIComponent(p))).join('=')) | ||
.sort() | ||
@@ -213,4 +221,4 @@ .join('&'); | ||
this.method, | ||
encodeRfc3986(this.encodedPath), | ||
encodeRfc3986(this.encodedSearch), | ||
this.encodedPath, | ||
this.encodedSearch, | ||
this.canonicalHeaders + '\n', | ||
@@ -217,0 +225,0 @@ this.signedHeaders, |
@@ -134,7 +134,15 @@ const encoder = new TextEncoder('utf-8'); | ||
this.encodedPath = | ||
this.service === 's3' ? decodeURIComponent(this.url.pathname) : this.url.pathname.replace(/\/+/g, '/'); | ||
if (this.service === 's3') { | ||
try { | ||
this.encodedPath = decodeURIComponent(this.url.pathname).replace(/\+/g, ' '); | ||
} catch (e) { | ||
this.encodedPath = this.url.pathname; | ||
} | ||
} else { | ||
this.encodedPath = this.url.pathname.replace(/\/+/g, '/'); | ||
} | ||
if (!singleEncode) { | ||
this.encodedPath = encodeURIComponent(this.encodedPath).replace(/%2F/g, '/'); | ||
} | ||
this.encodedPath = encodeRfc3986(this.encodedPath); | ||
@@ -151,3 +159,3 @@ const seenKeys = new Set(); | ||
}) | ||
.map(pair => pair.map(encodeURIComponent).join('=')) | ||
.map(pair => pair.map(p => encodeRfc3986(encodeURIComponent(p))).join('=')) | ||
.sort() | ||
@@ -209,4 +217,4 @@ .join('&'); | ||
this.method, | ||
encodeRfc3986(this.encodedPath), | ||
encodeRfc3986(this.encodedSearch), | ||
this.encodedPath, | ||
this.encodedSearch, | ||
this.canonicalHeaders + '\n', | ||
@@ -213,0 +221,0 @@ this.signedHeaders, |
@@ -140,7 +140,15 @@ (function (global, factory) { | ||
this.encodedPath = | ||
this.service === 's3' ? decodeURIComponent(this.url.pathname) : this.url.pathname.replace(/\/+/g, '/'); | ||
if (this.service === 's3') { | ||
try { | ||
this.encodedPath = decodeURIComponent(this.url.pathname).replace(/\+/g, ' '); | ||
} catch (e) { | ||
this.encodedPath = this.url.pathname; | ||
} | ||
} else { | ||
this.encodedPath = this.url.pathname.replace(/\/+/g, '/'); | ||
} | ||
if (!singleEncode) { | ||
this.encodedPath = encodeURIComponent(this.encodedPath).replace(/%2F/g, '/'); | ||
} | ||
this.encodedPath = encodeRfc3986(this.encodedPath); | ||
@@ -157,3 +165,3 @@ const seenKeys = new Set(); | ||
}) | ||
.map(pair => pair.map(encodeURIComponent).join('=')) | ||
.map(pair => pair.map(p => encodeRfc3986(encodeURIComponent(p))).join('=')) | ||
.sort() | ||
@@ -215,4 +223,4 @@ .join('&'); | ||
this.method, | ||
encodeRfc3986(this.encodedPath), | ||
encodeRfc3986(this.encodedSearch), | ||
this.encodedPath, | ||
this.encodedSearch, | ||
this.canonicalHeaders + '\n', | ||
@@ -219,0 +227,0 @@ this.signedHeaders, |
{ | ||
"name": "aws4fetch", | ||
"version": "1.0.1", | ||
"version": "1.0.2", | ||
"description": "", | ||
@@ -5,0 +5,0 @@ "main": "dist/aws4fetch.cjs.js", |
43563
788