handle case-insensitive vCard tags and UID property - #5649
Open
mateeaaa wants to merge 1 commit into
Open
Conversation
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
This PR resolves an issue in
ImportControllerwhere vCard files containing lowercase or mixed-case property tags (such asbegin:vcard,end:vcard, oruid:...) were either skipped entirely or had their UID ignored during import.Context & Root Cause
According to RFC 6350 Section 3.3 and RFC 2426, vCard property and parameter names are case-insensitive. Some contact export utilities output vCard delimiters and properties with lowercase or mixed-case formatting.
In
ImportController.php:$line === 'BEGIN:VCARD'and$line === 'END:VCARD'with strict case comparison. If a.vcffile containedbegin:vcard,$currentContactwas never initialized, causing contacts to be silently skipped.str_starts_with($line, self::UID_PREFIX)checked strictly for uppercaseUID:. When a contact haduid:...,$currentContactUidremainednull, preventing the existing contact deduplication lookup ($addressBook->search($uid, ...)) from executing and leading to duplicate entries upon re-import.Solution
strtoupper($line)when comparing againstBEGIN:VCARDandEND:VCARD.str_starts_with(strtoupper($line), self::UID_PREFIX)to reliably extract the UID regardless of casing.Changes Made
lib/Controller/ImportController.php: updatedBEGIN:VCARD,END:VCARD, andUID:tag checks to be case-insensitive.