fix(cli): strip CR inside quoted CSV fields, not just outside them - #947
Open
AmirF194 wants to merge 1 commit into
Open
fix(cli): strip CR inside quoted CSV fields, not just outside them#947AmirF194 wants to merge 1 commit into
AmirF194 wants to merge 1 commit into
Conversation
parseCSV's docstring claims RFC 4180 conformance for CRLF exports from Sheets, Excel, and CRMs. Outside a quoted field the parser drops every \r unconditionally, but inside a quoted field it appends \r to the field verbatim, so a Windows/Excel-produced multi-line cell (CRLF line breaks) imported via `e2a contacts import` bakes a stray carriage return into stored contact metadata. Mirrors the existing unquoted branch's unconditional \r drop.
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
parseCSV(cli/src/commands/contacts.ts) drops every\runconditionallyoutside a quoted field, but inside a quoted field it appends
\rto thefield verbatim. The function's own docstring claims RFC 4180 conformance
specifically for CRLF exports from Sheets/Excel/CRMs, and a Windows- or
Excel-produced multi-line cell uses CRLF line breaks internally too, so
importing one via
e2a contacts importbakes a stray carriage return intostored contact metadata.
Fix mirrors the existing unquoted branch: drop
\rinside a quoted fieldthe same unconditional way, instead of appending it.
Test plan
normalizes CRLF to LF inside a quoted multi-line field instead of leaking a raw CR) fails on unmodifiedmainand passes on this branch, both runs in a cleannode:22-slimcontainer.
npm run test:coverage --workspace @e2a/cli(322 tests) green.npm run build --workspace @e2a/cliandnpm run typecheck --workspace @e2a/cliboth clean.e2a contacts importpath end to end against areal API server; this is covered at the
parseCSVunit level only.