@@ -358,7 +358,7 @@ function s3uri(r) {
358
358
}
359
359
} else {
360
360
if ( provide_index_page && _isDirectory ( uriPath ) ) {
361
- uriPath += INDEX_PAGE ;
361
+ uriPath += INDEX_PAGE ;
362
362
}
363
363
path = basePath + uriPath ;
364
364
}
@@ -571,6 +571,7 @@ function _buildSignatureV4(r, amzDatetime, eightDigitDate, creds, bucket, region
571
571
} else {
572
572
uri = _escapeURIPath ( s3uri ( r ) ) ;
573
573
}
574
+
574
575
var canonicalRequest = _buildCanonicalRequest ( method , uri , queryParams , host , amzDatetime , creds . sessionToken ) ;
575
576
576
577
_debug_log ( r , 'AWS v4 Auth Canonical Request: [' + canonicalRequest + ']' ) ;
@@ -781,6 +782,31 @@ function _padWithLeadingZeros(num, size) {
781
782
return s . substr ( s . length - size ) ;
782
783
}
783
784
785
+ /**
786
+ * Adds additional encoding to a URI component
787
+ *
788
+ * @param string {string} string to encode
789
+ * @returns {string } an encoded string
790
+ * @private
791
+ */
792
+ function _encodeURIComponent ( string ) {
793
+ var additionalEscapes = [
794
+ [ / \( / g, '%28' ] ,
795
+ [ / \) / g, '%29' ] ,
796
+ [ / \! / g, '%21' ] ,
797
+ [ / \* / g, '%2A' ] ,
798
+ [ / \' / g, '%27' ]
799
+ ] ;
800
+
801
+ var encoded = encodeURIComponent ( string ) ;
802
+
803
+ additionalEscapes . forEach ( function ( replace ) {
804
+ encoded = encoded . replace ( replace [ 0 ] , replace [ 1 ] ) ;
805
+ } ) ;
806
+
807
+ return encoded ;
808
+ }
809
+
784
810
/**
785
811
* Escapes the path portion of a URI without escaping the path separator
786
812
* characters (/).
@@ -795,7 +821,7 @@ function _escapeURIPath(uri) {
795
821
let components = [ ] ;
796
822
797
823
decodedUri . split ( '/' ) . forEach ( function ( item , i ) {
798
- components [ i ] = encodeURIComponent ( item ) ;
824
+ components [ i ] = _encodeURIComponent ( item ) ;
799
825
} ) ;
800
826
801
827
return components . join ( '/' ) ;
@@ -1038,6 +1064,7 @@ export default {
1038
1064
// These functions do not need to be exposed, but they are exposed so that
1039
1065
// unit tests can run against them.
1040
1066
_padWithLeadingZeros,
1067
+ _encodeURIComponent,
1041
1068
_eightDigitDate,
1042
1069
_amzDatetime,
1043
1070
_splitCachedValues,
0 commit comments