Fix vCard import silently dropping properties with a non-item group prefix - #10271
Merged
Conversation
…refix Co-Authored-By: Claude Fable 5 <[email protected]>
MiMoHo
force-pushed
the
held-vcard-group-prefix
branch
from
July 16, 2026 08:14
93f20a3 to
81274d4
Compare
alecpl
pushed a commit
that referenced
this pull request
Jul 25, 2026
…refix (#10271) Co-authored-by: Claude Fable 5 <[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.
Problem
RFC 6350 permits any group name as a
group.prefix on a vCard property (e.g.HOME.EMAIL:...,group1.TEL:...). Roundcube only recognized Apple'sitem\d.prefix, so a property carrying any other group prefix was silently dropped on import: the email/phone/etc. never appeared in the parsed record.Root cause
rcube_vcard::cleanup()(program/lib/Roundcube/rcube_vcard.php:608) stripped only theitem\d*.prefix from property lines. Any survivinggroup.prefix (e.g.HOME.EMAIL) was carried intovcard_decode(), which then keyed the value under the literal field nameHOME.EMAILinstead ofEMAIL. Since that field is not in the fieldmap, the value was discarded.Fix
Generalize the prefix-stripping regex in
cleanup()from/^item\d*\./mito/^[a-z0-9-]+\./mi, so any RFC 6350 group prefix at the start of a line is removed before decoding. This runs after the existing Apple-specificX-ABRELATEDNAMES/X-ABLabelhandling and after theitem\d*.X-AB*cruft removal, so item-prefixed Apple label pairing is unaffected. Group names never contain dots and continuation lines begin with whitespace, so the pattern only matches genuine group prefixes.Testing
Added
test_parse_group_prefixin tests/Framework/VCardTest.php, importing a vCard withHOME.EMAIL:andgroup1.TEL:and asserting both are parsed into the record ($vcard->email[0], andemail:other/phone:otheringet_assoc()). The test fails on unmodified code and passes after the fix. The full VCardTest suite (15 tests, incl. the existingITEM1.-prefixed address case) passes, and phpstan level 4 reports no new errors.