Skip to content

fix(csv): quote fields containing lone carriage returns - #758

Merged
gkhngyk merged 1 commit into
ansvisor:mainfrom
dawNotPoi:fix/csv-lone-carriage-return
Aug 21, 2026
Merged

gkhngyk merged 1 commit into
ansvisor:mainfrom
dawNotPoi:fix/csv-lone-carriage-return

Conversation

@dawNotPoi

Copy link
Copy Markdown
Contributor

Summary

  • Quote CSV fields containing a lone carriage return so parsers do not split one row into multiple records.
  • Preserve the existing quoting behavior for CRLF values.
  • Add regression coverage for both lone CR and CRLF inputs.

Related issue

Closes #757

Type of change

  • feat — New feature
  • fix — Bug fix
  • chore — Maintenance / dependencies
  • docs — Documentation only
  • refactor — Code change that neither fixes a bug nor adds a feature
  • test — Adding or updating tests

Testing

  • yarn test — 16 files, 90 tests passed
  • yarn typecheck
  • yarn lint — 0 errors (8 pre-existing warnings)
  • yarn format:check — passed in a clean LF checkout matching CI
  • yarn build
  • git diff --check

Checklist

  • Branch follows the naming convention (feature/, fix/, chore/, docs/) — see CONTRIBUTING.md
  • Commits follow Conventional Commits
  • yarn lint passes (run from web/)
  • yarn typecheck passes (run from web/)
  • yarn format:check passes (run from web/)
  • Changes are focused — one concern per PR

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Welcome to Ansvisor, and thank you for your first PR! A maintainer will be by soon to review.

In the meantime, two things that make review faster:

  • A short description of why the change matters, not just what it does — most of our PRs link a Fixes #... to the issue that explains the why.
  • A quick local test note if there's anything worth eyeballing in the browser.

If you'd like to keep an eye on where Ansvisor goes next, a ⭐ on the repo helps others discover it (and Watch sends you a ping when related issues land). Either way — looking forward to your next one.

@dawNotPoi
dawNotPoi marked this pull request as ready for review August 21, 2026 04:01

@gkhngyk gkhngyk left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks — this is exactly the fix.

Verified the character class change does what the issue asked: line1\rline2 now quotes where it previously went out raw, and CRLF, LF, comma, quote and plain values are all unchanged. The lone-CR test fails on the old regex and passes on the new one, so the coverage is real.

Scope is right too — the formula-injection case stays untouched.

CI green across the board.

@gkhngyk
gkhngyk merged commit d190fbc into ansvisor:main Aug 21, 2026
5 checks passed
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.

bug: CSV export does not quote a field containing a lone carriage return

2 participants