File tree Expand file tree Collapse file tree 3 files changed +13
-6
lines changed Expand file tree Collapse file tree 3 files changed +13
-6
lines changed Original file line number Diff line number Diff line change @@ -18,10 +18,13 @@ function importOriginalImage() {
1818 // Assemble the image request
1919 const request = {
2020 bucket : bucketName ,
21- key : encodeURIComponent ( keyName )
21+ key : keyName
2222 }
2323 const strRequest = JSON . stringify ( request ) ;
24- const encRequest = btoa ( strRequest ) ;
24+ const encRequest = btoa ( encodeURIComponent ( strRequest ) . replace ( / % ( [ 0 - 9 A - F ] { 2 } ) / g, function ( match , p1 ) {
25+ return String . fromCharCode ( parseInt ( p1 , 16 ) )
26+ } ) ) ;
27+
2528 // Import the image data into the element
2629 $ ( `#img-original` )
2730 . attr ( `src` , `${ appVariables . apiEndpoint } /${ encRequest } ` )
@@ -77,14 +80,18 @@ function getPreviewImage() {
7780 // Set up the request body
7881 const request = {
7982 bucket : bucketName ,
80- key : encodeURIComponent ( keyName ) ,
83+ key : keyName ,
8184 edits : _edits
8285 }
8386 if ( Object . keys ( request . edits ) . length === 0 ) { delete request . edits }
8487 console . log ( request ) ;
8588 // Setup encoded request
8689 const str = JSON . stringify ( request ) ;
87- const enc = btoa ( str ) ;
90+
91+ const enc = btoa ( encodeURIComponent ( str ) . replace ( / % ( [ 0 - 9 A - F ] { 2 } ) / g, function ( match , p1 ) {
92+ return String . fromCharCode ( parseInt ( p1 , 16 ) )
93+ } ) ) ;
94+
8895 // Fill the preview image
8996 $ ( `#img-preview` ) . attr ( `src` , `${ appVariables . apiEndpoint } /${ enc } ` ) ;
9097 // Fill the request body field
Original file line number Diff line number Diff line change @@ -443,7 +443,7 @@ export class ImageHandler {
443443 alpha : string ,
444444 sourceImageMetadata : sharp . Metadata
445445 ) : Promise < Buffer > {
446- const params = { Bucket : bucket , Key : decodeURIComponent ( key ) } ;
446+ const params = { Bucket : bucket , Key : key } ;
447447 try {
448448 const { width, height } = sourceImageMetadata ;
449449 const overlayImage : S3 . GetObjectOutput = await this . s3Client . getObject ( params ) . promise ( ) ;
Original file line number Diff line number Diff line change @@ -269,7 +269,7 @@ export class ImageRequest {
269269 if ( requestType === RequestTypes . DEFAULT ) {
270270 // Decode the image request and return the image key
271271 const { key } = this . decodeRequest ( event ) ;
272- return decodeURIComponent ( key ) ;
272+ return key ;
273273 }
274274
275275 if ( requestType === RequestTypes . THUMBOR || requestType === RequestTypes . CUSTOM ) {
You can’t perform that action at this time.
0 commit comments