Skip to content

Commit e4689f5

Browse files
dougtoppinDoug Toppin
andauthored
Resolve #416 demo-ui unicode support (#422)
Co-authored-by: Doug Toppin <[email protected]>
1 parent 75c6b24 commit e4689f5

File tree

3 files changed

+4
-4
lines changed

3 files changed

+4
-4
lines changed

source/demo-ui/scripts.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ function importOriginalImage() {
1818
// Assemble the image request
1919
const request = {
2020
bucket: bucketName,
21-
key: keyName
21+
key: encodeURIComponent(keyName)
2222
}
2323
const strRequest = JSON.stringify(request);
2424
const encRequest = btoa(strRequest);
@@ -77,7 +77,7 @@ function getPreviewImage() {
7777
// Set up the request body
7878
const request = {
7979
bucket: bucketName,
80-
key: keyName,
80+
key: encodeURIComponent(keyName),
8181
edits: _edits
8282
}
8383
if (Object.keys(request.edits).length === 0) { delete request.edits }

source/image-handler/image-handler.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff 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: key };
446+
const params = { Bucket: bucket, Key: decodeURIComponent(key) };
447447
try {
448448
const { width, height } = sourceImageMetadata;
449449
const overlayImage: S3.GetObjectOutput = await this.s3Client.getObject(params).promise();

source/image-handler/image-request.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff 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 key;
272+
return decodeURIComponent(key);
273273
}
274274

275275
if (requestType === RequestTypes.THUMBOR || requestType === RequestTypes.CUSTOM) {

0 commit comments

Comments
 (0)