Skip to content

fix: do not flag a malformed-quote error when a \r\n line ending is s…#1127

Open
Jian-Zhang08 wants to merge 1 commit into
mholt:masterfrom
Jian-Zhang08:fix/quoted-field-crlf-chunk-boundary
Open

fix: do not flag a malformed-quote error when a \r\n line ending is s…#1127
Jian-Zhang08 wants to merge 1 commit into
mholt:masterfrom
Jian-Zhang08:fix/quoted-field-crlf-chunk-boundary

Conversation

@Jian-Zhang08

Copy link
Copy Markdown

…plit across a chunk boundary (#1103)

When streaming, a chunk can end on the \r of a \r\n line ending, leaving a closing quote followed only by a lone \r. That \r matches neither the delimiter nor a full newline, so the parser reported a spurious "Trailing quote on quoted field is malformed" (InvalidQuotes) error even though the row is simply incomplete and is already deferred to the next chunk via _partialLine (no data is lost).

Guard the InvalidQuotes branch: when ignoreLastRow is set (more chunks are coming) and there is no further newline left in this chunk, defer the row instead of emitting the error. Genuine malformed quotes are unaffected (there a newline still follows, or it is the final chunk).

Adds a regression test that parses a quoted CSV with a \r\n line ending split across a chunk boundary and asserts no error is produced.

…plit across a chunk boundary (mholt#1103)

When streaming, a chunk can end on the \r of a \r\n line ending, leaving a
closing quote followed only by a lone \r. That \r matches neither the
delimiter nor a full newline, so the parser reported a spurious
"Trailing quote on quoted field is malformed" (InvalidQuotes) error even
though the row is simply incomplete and is already deferred to the next
chunk via _partialLine (no data is lost).

Guard the InvalidQuotes branch: when ignoreLastRow is set (more chunks are
coming) and there is no further newline left in this chunk, defer the row
instead of emitting the error. Genuine malformed quotes are unaffected
(there a newline still follows, or it is the final chunk).

Adds a regression test that parses a quoted CSV with a \r\n line ending
split across a chunk boundary and asserts no error is produced.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant