Skip to content

Fix unicode unescape behavior affected by sequential replace - #472

Merged
hlship merged 1 commit into
walmartlabs:masterfrom
chage:fix/unescape-unicode-backslash-edge-case
Mar 10, 2026
Merged

Fix unicode unescape behavior affected by sequential replace#472
hlship merged 1 commit into
walmartlabs:masterfrom
chage:fix/unescape-unicode-backslash-edge-case

Conversation

@chage

@chage chage commented Mar 9, 2026

Copy link
Copy Markdown
Contributor

I believe there is an issue in the unicode unescape logic.

The current implementation performs two replace operations sequentially, where the second replacement may be affected by the result of the first one. This can lead to incorrect behavior in certain cases.

I'm not sure whether this behavior was intentional. Looking through the commit history, it appears the implementation has been this way since it was introduced, and I couldn't find additional context explaining the design choice.

To clarify the problem, I added a test case that demonstrates the issue.

Please see the new test for a concrete example of the behavior.

@hlship hlship added this to the 1.3.0 milestone Mar 10, 2026
@hlship

hlship commented Mar 10, 2026

Copy link
Copy Markdown
Member

Thanks for the patch; did you find this in the wild? That an awful lot of escaping and unescaping!

@hlship
hlship merged commit f7eba10 into walmartlabs:master Mar 10, 2026
8 of 9 checks passed
@chage

chage commented Mar 11, 2026

Copy link
Copy Markdown
Contributor Author

Yes. We use a JSON scalar type in a query field, and one day someone submitted some unusual data. 😅

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants