Fix email({ allowMultiple: true }) format/parse round-trip for quoted commas#626
Fix email({ allowMultiple: true }) format/parse round-trip for quoted commas#626
email({ allowMultiple: true }) format/parse round-trip for quoted commas#626Conversation
email({ allowMultiple: true }).format() now joins addresses with ", "
(comma-space) instead of bare ",", so quoted local parts containing
commas survive a format() → parse() cycle.
Close #354
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
|
Warning You have reached your daily quota limit. Please wait up to 24 hours and I will start processing your requests again! |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #626 +/- ##
=======================================
Coverage 94.92% 94.92%
=======================================
Files 38 38
Lines 17431 17431
Branches 4599 4600 +1
=======================================
Hits 16546 16546
Misses 873 873
Partials 12 12 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository UI Review profile: ASSERTIVE Plan: Pro Run ID: 📒 Files selected for processing (3)
WalkthroughThe pull request fixes an email formatting bug in the Estimated code review effort🎯 1 (Trivial) | ⏱️ ~5 minutes Possibly related PRs
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
📝 Coding Plan
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Summary
email({ allowMultiple: true })could not round-trip values whose local parts contained quoted commas.format()joined addresses with a bare,, producing output like"Doe, John"@example.com,x@example.com. WhilesplitEmails()happened to handle this correctly due to its quote-tracking state machine, the bare comma join was fragile and not guaranteed to be unambiguous.This PR changes
format()to use,(comma-space) as the separator instead. This is safe because email addresses cannot start with whitespace, andparse()already trims each split result. It also matches the RFC 5322 conventional separator for address lists.Closes #354
Test plan
"Doe, John"@example.com)"a\"b,c"@example.com)mise testpasses across Deno, Node.js, and Bun