Fix incorrect unfolding of folded lines for vCard 2.1 imports (#9647) - #10218
Merged
Conversation
…ube#9647) vCard line unfolding was hardcoded to the RFC 2425 rule used by vCard 3.0/4.0, which drops the folding whitespace entirely. vCard 2.1 follows RFC 822, where a CRLF immediately followed by a LWSP-char is equivalent to that LWSP-char, i.e. the folding whitespace must be kept. As a result, a folded value such as NOTE:an example was imported as "anexample" instead of "an example". Extract a version-aware unfold() helper and use it in both vcard_decode() and detect_encoding(), keeping the folding whitespace for vCard 2.1 while preserving the existing behaviour for 3.0/4.0. Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
2 tasks
Contributor
Author
|
Friendly ping — this PR is ready for review whenever a maintainer has a moment. 🙏 A note on CI: the only red checks on the previous run were two Windows / PHP Unit jobs, and both were transient infrastructure failures unrelated to this change:
Everything substantive passed — Coding Style, Static Analysis, and the full Unit / E2E / Message Rendering matrix on Linux PHP 8.1–8.5 (plus Windows PHP 8.2/8.4/8.5). I've pushed an empty commit to re-trigger CI, but the new runs are sitting in action_required (awaiting maintainer approval to run). Could a maintainer approve the workflows and take a look when convenient? Happy to address any feedback. Thanks! |
alecpl
pushed a commit
that referenced
this pull request
Jun 7, 2026
…#10218) * Fix incorrect unfolding of folded lines for vCard 2.1 imports (#9647) vCard line unfolding was hardcoded to the RFC 2425 rule used by vCard 3.0/4.0, which drops the folding whitespace entirely. vCard 2.1 follows RFC 822, where a CRLF immediately followed by a LWSP-char is equivalent to that LWSP-char, i.e. the folding whitespace must be kept. As a result, a folded value such as NOTE:an example was imported as "anexample" instead of "an example". Extract a version-aware unfold() helper and use it in both vcard_decode() and detect_encoding(), keeping the folding whitespace for vCard 2.1 while preserving the existing behaviour for 3.0/4.0. Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]> * ci: re-trigger checks (transient Windows infra failures) --------- Co-authored-by: Claude Opus 4.8 (1M context) <[email protected]>
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 #9647.
vCard line unfolding was hardcoded to the RFC 2425 rule used by vCard 3.0/4.0, which drops the folding whitespace entirely. vCard 2.1 instead follows RFC 822, where "CRLF immediately followed by a LWSP-char is equivalent to the LWSP-char" — i.e. the folding whitespace must be kept.
As a result, importing a folded vCard 2.1 value such as:
produced
anexampleinstead ofan example. Multi-word notes, organizations, etc. got their words fused together on import.Changes
unfold()helper inrcube_vcard.VERSION:2.1, keep the single folding whitespace; otherwise behave exactly as before (drop it, per RFC 2425).vcard_decode()anddetect_encoding()), mirroring how vcard: Fix whitespace handling in line cont's #9637 fixed the related 3.0/4.0 whitespace bug.Tests
test_parse_v21_continuation_line_keeps_whitespacetotests/Framework/VCardTest.php, alongside the existing 3.0 continuation-line test.VCardTestsuite passes; the existing 3.0/4.0 behaviour is unchanged.Notes
This complements #9637 (which fixed the analogous whitespace handling for vCard 3.0/4.0). See also sabre/vobject#690 for the same distinction.