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

fix(demo-ui): demo UI unicode support #422

Merged
merged 1 commit into from
Jan 17, 2023
Merged

fix(demo-ui): demo UI unicode support #422

merged 1 commit into from
Jan 17, 2023

Conversation

dougtoppin
Copy link
Contributor

@dougtoppin dougtoppin commented Jan 11, 2023

Issue #, if available:
#416 Add unicode support to demo-ui to enable the use of keys containing unicode characters

This was an issue discovered by @batica81 where the demo-ui component of SIH did not support image keys containing unicode characters. The initial suggested fix included the use of a deprecated function.
The fixes contained in this PR were suggested by @fisenkodv did not use the deprecated function and tested successfully.

While testing, it was discovered that the use of watermark (overlay) images also did not support unicode characters in the backend which has been resolved in this PR.

Description of changes:

  • scripts (front-end) encode key in request using encodeURIComponent
  • image-request (backend) decode key using decodeURIComponent when request received
  • image-handler (backend) decode key for watermark

Tested using combinations of keys with both ascii and unicode characters for both image and watermark keys.

Example test request bodies:

  • unicode key (sharp style after base64 -d):
  {"bucket":"test-bucket","key":"Västerås.jpeg","edits":{"contentModeration":{"minConfidence":90,"blur":100,"moderationLabels":["Gambling"]}}}

Checklist

  • 👋 I have run the unit tests, and all unit tests have passed.
  • ⚠️ This pull request might incur a breaking change.

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

Copy link
Contributor

@fisenkodv fisenkodv left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me

@hearde
Copy link
Member

hearde commented Jan 17, 2023

Is there a way to test this?

@dougtoppin
Copy link
Contributor Author

@hearde My testing was to deploy the stack, copy an image to a unicode name for both the key and watermark and try various tests using different combinations. That was using both the demo-ui and api for various tests.
Supporting regression tests in the repo is on our backlog and will include the demo-ui. We also have updating the demo-ui in the backlog.

@dougtoppin dougtoppin merged commit e4689f5 into aws-solutions:develop Jan 17, 2023
@dougtoppin dougtoppin deleted the fix/demo-ui-intl-characters branch January 17, 2023 21:46
@dougtoppin dougtoppin mentioned this pull request Jan 25, 2023
3 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants