Fix utf8 encoding for payload#1039
Merged
Assem-Uber merged 3 commits intocadence-workflow:masterfrom Sep 26, 2025
Merged
Conversation
Signed-off-by: Assem Hafez <assem.hafez@uber.com>
Contributor
There was a problem hiding this comment.
Pull Request Overview
This PR fixes UTF-8 encoding issues when decoding base64 payloads by replacing the native atob function with a proper UTF-8 decoder. The change addresses broken display of user-added inputs containing non-ASCII characters.
- Created a utility function
formatBase64Payloadthat properly handles UTF-8 encoding using Node.js Buffer - Replaced all instances of
atobwith the new utility across workflow history event formatters and payload formatters - Added comprehensive tests covering various character sets including mixed languages, Cyrillic, Chinese, Arabic, Hebrew, and emojis
Reviewed Changes
Copilot reviewed 12 out of 12 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| src/utils/data-formatters/format-base64-payload.ts | New utility function for proper UTF-8 base64 decoding |
| src/utils/data-formatters/tests/format-base64-payload.test.ts | Test suite covering various UTF-8 character encodings |
| src/utils/data-formatters/format-payload.ts | Updated to use new UTF-8 decoder utility |
| src/utils/data-formatters/format-input-payload.ts | Updated to use new UTF-8 decoder utility |
| src/utils/data-formatters/format-failure-details.ts | Updated to use new UTF-8 decoder utility |
| src/utils/data-formatters/format-workflow-history-event/*.ts | Multiple workflow event formatters updated to use new UTF-8 decoder for control fields |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
adhityamamallan
approved these changes
Sep 26, 2025
| }); | ||
|
|
||
| it('should decode "ЕГ" from known base64 encoding', () => { | ||
| const result = formatBase64Payload('0JXQkw=='); |
Member
There was a problem hiding this comment.
This case should be covered by the one above (same for "hello world")
Alternatively, you can have separate test cases for different scripts (Latin, Cyrillic, Arabic, etc)
Signed-off-by: Assem Hafez <assem.hafez@uber.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Decoding utf-8 payloads is broken since we are using
atobfor decoding the base64 strings created bygrpc-loaderfor Byte data. This causes wrong value display for user added inputs.Fixes #1011
Changes*
utf-8strings.base64string.Screenshots
