fix(destination-google-sheets): sanitize " in cell values to prevent pasteData column misalignment #357
Draft
sgresh-stripe wants to merge 2 commits intomainfrom
Draft
fix(destination-google-sheets): sanitize " in cell values to prevent pasteData column misalignment #357sgresh-stripe wants to merge 2 commits intomainfrom
sgresh-stripe wants to merge 2 commits intomainfrom
Conversation
… to prevent pasteData column misalignment
The Google Sheets pasteData API applies RFC 4180-like quoting semantics
even when a custom delimiter (U+001F) is used. An unescaped `"` mid-value
causes the server-side parser to enter quoted-field mode and absorb
subsequent \x1f delimiters as content rather than column separators,
silently dropping the columns that follow.
A customer whose description field contained embedded JSON (e.g.
`{"custom_fields":null,"default_payment_method":null,...}`) triggered
this: the 6 columns after the description were missing from the written
row.
Fix: add `"` to PASTE_SANITIZE_RE; replace with `'` to preserve
readability. Adds two regression tests — a rowsToTsv unit test asserting
no raw double-quotes in the output, and a full-destination integration
test verifying row column count is preserved.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Committed-By-Agent: claude
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.
Problem
A customer whose
descriptionfield contained embedded JSON (e.g.{"custom_fields":null,"default_payment_method":null,...}) caused the 6 columns afterdescriptionto go missing from every written row.Root cause: The Google Sheets
pasteDataAPI applies RFC 4180-like CSV quoting semantics even when a custom delimiter (U+001F) is specified. An unescaped"mid-cell causes the server-side parser to enter quoted-field mode, absorbing subsequent\x1fdelimiters as literal content instead of column separators — which drops every column after the affected cell.Fix
Add
"toPASTE_SANITIZE_REinsanitizeForPaste. Double-quotes are replaced with'(single-quote) rather than a space to keep JSON-serialized values readable ({"key":null}→{'key':null}).Tests
rowsToTsvwith a row containing the exact customer description from the report — asserts no raw"in TSV output and all 8 cells are still delimited correctly."does not appear in the written cell.value stringificationtest whose expected JSON literal now reflects the sanitized form ('instead of").