Skip to content

Commit 1826412

Browse files
dougtoppinDoug Toppingsingh04
authored
Release/v6.1.1 (aws-solutions#443)
* Update CHANGELOG.md Correct release date * Remove unicode changes from backend, fix unicode support in demo-ui * Use stack name in Service Catalog Application name for multiple cfn stack deployments (aws-solutions#438) * Add stack name to service catalog application This allows multiple stack deployments in the same account, region * Update cdk snapshot * Add changelog entry * Prepend AppRegistry application name with static name Stack name is used in naming AppRegistry application and attribute group; which must not begin with aws. The change adds support for stack names starting with aws-* * Update to v6.1.1, set release date, include PR link --------- Co-authored-by: Doug Toppin <[email protected]> Co-authored-by: garvit singh <[email protected]>
1 parent 1659062 commit 1826412

File tree

6 files changed

+30
-11
lines changed

6 files changed

+30
-11
lines changed

CHANGELOG.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,14 @@ All notable changes to this project will be documented in this file.
55
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
66
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
77

8-
## [6.1.1] - 2022-01-26
8+
## [6.1.1] - 2023-02-09
99

1010
### Added
1111

1212
- package-lock.json for all modules [#426](https://github.com/aws-solutions/serverless-image-handler/pull/426)
1313
- github workflows for running unit test, eslint and prettier formatting, cdk nag, security scans [#402](https://github.com/aws-solutions/serverless-image-handler/pull/402)
1414
- demo-ui unicode support [#416](https://github.com/aws-solutions/serverless-image-handler/issues/416)
15+
- support for multiple cloudformation stack deployments in the same region [#438](https://github.com/aws-solutions/serverless-image-handler/pull/438)
1516

1617
### Changed
1718

source/constructs/lib/common-resources/common-resources-construct.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ export class CommonResources extends Construct {
9393
const applicationType = "AWS-Solutions";
9494

9595
const application = new appreg.Application(stack, "AppRegistry", {
96-
applicationName: Fn.join("-", [props.applicationName, Aws.REGION, Aws.ACCOUNT_ID]),
96+
applicationName: Fn.join("-", ["AppRegistry", Aws.STACK_NAME, Aws.REGION, Aws.ACCOUNT_ID]),
9797
description: `Service Catalog application to track and manage all your resources for the solution ${props.applicationName}`,
9898
});
9999
application.associateStack(stack);
@@ -104,7 +104,7 @@ export class CommonResources extends Construct {
104104
Tags.of(application).add("Solutions:ApplicationType", applicationType);
105105

106106
const attributeGroup = new appreg.AttributeGroup(stack, "DefaultApplicationAttributes", {
107-
attributeGroupName: Aws.STACK_NAME,
107+
attributeGroupName: `AppRegistry-${Aws.STACK_NAME}`,
108108
description: "Attribute group for solution information",
109109
attributes: {
110110
applicationType,

source/constructs/test/__snapshots__/constructs.test.ts.snap

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -333,7 +333,10 @@ exports[`Serverless Image Handler Stack Snapshot 1`] = `
333333
"Fn::Join": [
334334
"-",
335335
[
336-
"sih",
336+
"AppRegistry",
337+
{
338+
"Ref": "AWS::StackName",
339+
},
337340
{
338341
"Ref": "AWS::Region",
339342
},
@@ -1823,7 +1826,15 @@ exports[`Serverless Image Handler Stack Snapshot 1`] = `
18231826
},
18241827
"Description": "Attribute group for solution information",
18251828
"Name": {
1826-
"Ref": "AWS::StackName",
1829+
"Fn::Join": [
1830+
"",
1831+
[
1832+
"AppRegistry-",
1833+
{
1834+
"Ref": "AWS::StackName",
1835+
},
1836+
],
1837+
],
18271838
},
18281839
"Tags": {
18291840
"SolutionId": "S0ABC",

source/demo-ui/scripts.js

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff 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-9A-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-9A-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

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: 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();

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 decodeURIComponent(key);
272+
return key;
273273
}
274274

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

0 commit comments

Comments
 (0)