Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(release): 6.1.1 #439

Merged
merged 3 commits into from
Feb 8, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,14 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [6.1.1] - 2023-02-02
## [6.1.1] - 2023-02-09

### Added

- package-lock.json for all modules [#426](https://github.com/aws-solutions/serverless-image-handler/pull/426)
- 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)
- demo-ui unicode support [#416](https://github.com/aws-solutions/serverless-image-handler/issues/416)
- support for multiple cloudformation stack deployments in the same region [#438](https://github.com/aws-solutions/serverless-image-handler/pull/438)

### Changed

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ export class CommonResources extends Construct {
const applicationType = "AWS-Solutions";

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

const attributeGroup = new appreg.AttributeGroup(stack, "DefaultApplicationAttributes", {
attributeGroupName: Aws.STACK_NAME,
attributeGroupName: `AppRegistry-${Aws.STACK_NAME}`,
description: "Attribute group for solution information",
attributes: {
applicationType,
Expand Down
15 changes: 13 additions & 2 deletions source/constructs/test/__snapshots__/constructs.test.ts.snap
Original file line number Diff line number Diff line change
Expand Up @@ -333,7 +333,10 @@ exports[`Serverless Image Handler Stack Snapshot 1`] = `
"Fn::Join": [
"-",
[
"sih",
"AppRegistry",
{
"Ref": "AWS::StackName",
},
{
"Ref": "AWS::Region",
},
Expand Down Expand Up @@ -1823,7 +1826,15 @@ exports[`Serverless Image Handler Stack Snapshot 1`] = `
},
"Description": "Attribute group for solution information",
"Name": {
"Ref": "AWS::StackName",
"Fn::Join": [
"",
[
"AppRegistry-",
{
"Ref": "AWS::StackName",
},
],
],
},
"Tags": {
"SolutionId": "S0ABC",
Expand Down
15 changes: 11 additions & 4 deletions source/demo-ui/scripts.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,13 @@ function importOriginalImage() {
// Assemble the image request
const request = {
bucket: bucketName,
key: encodeURIComponent(keyName)
key: keyName
}
const strRequest = JSON.stringify(request);
const encRequest = btoa(strRequest);
const encRequest = btoa(encodeURIComponent(strRequest).replace(/%([0-9A-F]{2})/g, function(match, p1) {
return String.fromCharCode(parseInt(p1, 16))
}));

// Import the image data into the element
$(`#img-original`)
.attr(`src`, `${appVariables.apiEndpoint}/${encRequest}`)
Expand Down Expand Up @@ -77,14 +80,18 @@ function getPreviewImage() {
// Set up the request body
const request = {
bucket: bucketName,
key: encodeURIComponent(keyName),
key: keyName,
edits: _edits
}
if (Object.keys(request.edits).length === 0) { delete request.edits }
console.log(request);
// Setup encoded request
const str = JSON.stringify(request);
const enc = btoa(str);

const enc = btoa(encodeURIComponent(str).replace(/%([0-9A-F]{2})/g, function(match, p1) {
return String.fromCharCode(parseInt(p1, 16))
}));

// Fill the preview image
$(`#img-preview`).attr(`src`, `${appVariables.apiEndpoint}/${enc}`);
// Fill the request body field
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: decodeURIComponent(key) };
const params = { Bucket: bucket, Key: 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 decodeURIComponent(key);
return key;
}

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