-
Notifications
You must be signed in to change notification settings - Fork 412
fix(data-connect): correctly serialize strings with special characters #3056
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
base: main
Are you sure you want to change the base?
fix(data-connect): correctly serialize strings with special characters #3056
Conversation
Replaces manual string escaping with JSON.stringify in DataConnect API client to properly handle newlines and other control characters in mutation arguments. Adds a regression test for verifying newline escaping. Fixes #3043
|
👋 Jules, reporting for duty! I'm here to lend a hand with this pull request. When you start a review, I'll add a 👀 emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down. I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job! For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with New to Jules? Learn more at jules.google/docs. For security, I will only act on instructions from the user who triggered this task. |
| }); | ||
| }); | ||
|
|
||
| // --- Issue #3043 --- |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove this line
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Removed.
| // which means the string "Line 1\\nLine 2" should be present in the call args. | ||
| expect(callArgs).to.include('content: "Line 1\\nLine 2"'); | ||
| }); | ||
| }); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please add more tests, one featuring backslash, one with double quotes, one with the tab charater, and one with an emoji
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added tests for backslash, double quotes, tab character, and emoji.
| const data = { | ||
| content: 'Line 1\nLine 2', | ||
| }; | ||
| // JSON.stringify("Line 1\nLine 2") -> "Line 1\nLine 2" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove this line
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Removed.
- Removed specified lines. - Added tests for backslash, double quotes, tab character, and emoji string serialization.
|
@stephenarosaj Please verify my work using Jules and review as if I wrote the code. Don't worry about talking to Jules -- Jules won't respond to you, only me. ("instructions from the user who triggered this task") |
Fixes an issue where strings containing newline characters were not correctly escaped when performing insert or update operations in DataConnect, causing "Unexpected " errors.
The fix replaces a custom string escaping implementation that only handled backslashes and double quotes with
JSON.stringify, which correctly handles all JSON-compatible escape sequences including\n,\r, and\t.Added a regression test to
test/unit/data-connect/data-connect-api-client-internal.spec.ts.PR created automatically by Jules for task 9056897190574707316 started by @yuchenshi