Import-DbaCsv - Fix RFC 4180 multiline quoted field handling#10190
Merged
potatoqualitee merged 1 commit intodataplat:developmentfrom Feb 26, 2026
Merged
Conversation
Two bugs caused valid CSV files with multiline quoted fields to be rejected. The pre-validation used -notmatch which rejects the file if ANY sampled line lacks the delimiter, but Get-Content splits mid-field on embedded newlines. Changed to -match so only files with NO delimiter matches are rejected. Also enabled AllowMultilineFields by default when QuoteMode is Strict (RFC 4180), since the spec explicitly allows CR/LF inside quoted fields. Fixes dataplat#10188 Fixes dataplat#10189 (do Import-DbaCsv) Co-Authored-By: Claude Opus 4.6 <[email protected]>
Member
|
Looks reasonable, thank you very much for the fix! |
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
Fixes two bugs that caused
Import-DbaCsvto reject valid CSV files containing multiline quoted fields (permitted by RFC 4180).Pre-validation false rejection (Import-DbaCsv Pre-validation incorrectly rejects valid CSV files with multiline quoted fields #10188): The delimiter check used
-notmatchon lines read byGet-Content, which splits on newlines without understanding CSV quoting. If any sampled line lacked the delimiter (e.g. a continuation line from a multiline quoted field), the file was rejected. Changed to-matchso the file is only rejected when no sampled lines contain the delimiter.Multiline fields disabled by default in Strict mode (Import-DbaCsv Multiline quoted fields cause parse errors by default with RFC 4180 Strict mode #10189):
AllowMultilineFieldsdefaulted to$falsedespiteQuoteModedefaulting toStrict("RFC 4180 compliant"). RFC 4180 explicitly allows CR/LF inside quoted fields. NowAllowMultilineFieldsdefaults to$truewhenQuoteModeisStrict, unless-SupportsMultilineis explicitly provided. Applied consistently across all threeCsvReaderOptionsconstruction sites (table creation, schema inference, and main import).Fixes #10188
Fixes #10189
Test plan
-SupportsMultiline(triggers Bug 2)-QuoteMode Lenientconfirms multiline stays off unless-SupportsMultilineis passedImport-DbaCsvtests pass(do Import-DbaCsv)