Repository navigation
fix: accept a byte order mark before the transaction CSV header - #146
Merged
Merged
Conversation
Signed-off-by: Charan Rathore <180254320+charan-rathore@users.noreply.github.com>
jerelvelarde
approved these changes
Oct 6, 2026
jerelvelarde
left a comment
Collaborator
There was a problem hiding this comment.
Value: BOM-prefixed bank CSVs with quoted headers import correctly while existing quote validation remains intact. Seven finance/header tests passed. Template: explicit checks and untested paths. No actionable security finding. Updated-main diff reviewed; merge after required CI.
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.
What changed
Pasting a transaction CSV that starts with a UTF-8 byte order mark (BOM) failed with "Invalid quoted CSV field" whenever the header row was quoted, for example
"date","description","amount","category". Excel, Numbers and many bank exports write that mark at the start of the file, and it can come along when the text is copied.The cause is in
analyzeSpending. It parses the text character by character. The BOM (U+FEFF) was read as the first character of the first cell. When the next character was the opening quote, the parser saw text before the quote and rejected the field. Unquoted headers only worked becausetrim()happens to strip U+FEFF.The fix drops a single leading U+FEFF before parsing. Nothing else about the parser changes, so the quote checks added in #69 still apply to everything after it.
Verification
npx tsx --test tests/finance.test.ts tests/finance-headers.test.ts: 7 passed, 0 failed.npx biome checkon the two changed files: clean.npx tsc --noEmit: clean.pnpm test, the mobile and platform builds, and the browser suites. This change touches only the server-side CSV parser and its test.