Skip to content

Commit

Permalink
Resolve #416 demo-ui unicode support (#422)
Browse files Browse the repository at this point in the history
Co-authored-by: Doug Toppin <[email protected]>
  • Loading branch information
dougtoppin and Doug Toppin authored Jan 17, 2023
1 parent 75c6b24 commit e4689f5
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions source/demo-ui/scripts.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ function importOriginalImage() {
// Assemble the image request
const request = {
bucket: bucketName,
key: keyName
key: encodeURIComponent(keyName)
}
const strRequest = JSON.stringify(request);
const encRequest = btoa(strRequest);
Expand Down Expand Up @@ -77,7 +77,7 @@ function getPreviewImage() {
// Set up the request body
const request = {
bucket: bucketName,
key: keyName,
key: encodeURIComponent(keyName),
edits: _edits
}
if (Object.keys(request.edits).length === 0) { delete request.edits }
Expand Down
2 changes: 1 addition & 1 deletion source/image-handler/image-handler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -443,7 +443,7 @@ export class ImageHandler {
alpha: string,
sourceImageMetadata: sharp.Metadata
): Promise<Buffer> {
const params = { Bucket: bucket, Key: key };
const params = { Bucket: bucket, Key: decodeURIComponent(key) };
try {
const { width, height } = sourceImageMetadata;
const overlayImage: S3.GetObjectOutput = await this.s3Client.getObject(params).promise();
Expand Down
2 changes: 1 addition & 1 deletion source/image-handler/image-request.ts
Original file line number Diff line number Diff line change
Expand Up @@ -269,7 +269,7 @@ export class ImageRequest {
if (requestType === RequestTypes.DEFAULT) {
// Decode the image request and return the image key
const { key } = this.decodeRequest(event);
return key;
return decodeURIComponent(key);
}

if (requestType === RequestTypes.THUMBOR || requestType === RequestTypes.CUSTOM) {
Expand Down

0 comments on commit e4689f5

Please sign in to comment.