Skip to content

Fix #2390: don't silently truncate CSV columns, handle preamble row - #2410

Open
Mohamed Elfeky (FekyBaz) wants to merge 1 commit into
microsoft:mainfrom
FekyBaz:fix-2390-csv-no-silent-truncate
Open

Fix #2390: don't silently truncate CSV columns, handle preamble row#2410
Mohamed Elfeky (FekyBaz) wants to merge 1 commit into
microsoft:mainfrom
FekyBaz:fix-2390-csv-no-silent-truncate

Conversation

@FekyBaz

Copy link
Copy Markdown

Fixes #2390.CsvConverter treated rows[0] as header unconditionally and silently truncated wider data rows via row[:len(rows[0])].Adds two behaviors:- Preamble heuristic: lone single-field first row followed by a wider row is emitted as plain text and the second row becomes the header (covers WizTree exports whose line 1 is a banner and line 2 is the real header).- No silent loss otherwise: table widens to max row width with a UserWarning instead of truncating.Also avoids mutating parsed rows in place.Short rows are still padded; empty inner rows keep existing behavior.Verified with WizTree repro plus existing CSV expectations (BOM, blank rows, pipe escaping).

@FekyBaz

Copy link
Copy Markdown
Author

@microsoft-github-policy-service agree

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.

CSV converter silently truncates data columns when rows have more fields than the header row

1 participant