[Help] iPhone corrupting vCards

Since upgrading to Nextcloud 15 and Contacts 3.0.1, I have noticed that the Nextcloud Contacts Web UI was not displaying things like Addresses for some contacts.

The address book in question is synced two ways to an iPhone and to Mail client, Thunderbird
Editing of a contact, on the iPhone, results in vCard fields changing, for example, from ADR to ITEM1.ADR
Whilst this successfully syncs up to the Nextcloud storage and on to Thunderbird, the Contacts Web UI does not understand these ITEM entries (and IMHO, rightly so, given the vCard is version 3.0 and I see no mention of ITEM# in the vCard RFC, please correct me if I am wrong).

I also see, in the iPhone buggered vcards, what I consider to be invalid use of the PREF entry, things like PREF=home or PREF by itself where the standard says PREF requires an integer parameter 1-100 where 1 is the most preferred.

My entire address book has just over 100 ITEM#. entries in it now and I am wondering if there is a tool somewhere that can ‘fix’ my vCards without me having to laboriously fix each one by hand.

I use linux and am a long-time user thereof, have downloaded the entire addressbook and can get my self in trouble with Python, Perl and Bash and am a power user of emacs. I figure I download the entire address book, fix it, delete it all in the Web UI and re-import the fixed one. Maybe just delete and re-load the faulty entries to prevent a sync overload :slight_smile:

Suggestions greatly appreciated.

Nextcloud version 15 Contacts 3.0.1:
Operating system and version : Shared Linux hosting
Apache or nginx version : Apache
PHP version : 7.1

@lyallp Can you confirm that a newly created vcard on the iPhone contains broken PREFs? In that case this should ideally be handled by the Contacts app, even if not 100% standard complaint. cc @skjnldsv

See below, a vcard created entirely on the iPhone. Downloaded from Nextcloud Contacts app and pasted here.

The phone 1234567890, rather than using built in home/work labels, I used a ‘custom’ label “PREF,CELL” which came with the iphone, not added by myself.

Also note that whilst this successfully synced from iPhone to Nextcloud, contacts searching for ‘next’ or ‘cloud’ failed. I had to manually scan through my contacts to find it.

BEGIN:VCARD
VERSION:3.0
PRODID:-//Apple Inc.//iOS 12.1.2//EN
N:Cloud;Next;;;
FN:Next Cloud
EMAIL;type=INTERNET;type=HOME;type=pref:a.b.com
EMAIL;type=INTERNET;type=HOME:c@d.com
item1.TEL;type=pref:1234567890
item1.X-ABLabel:PREF\,CELL
TEL;type=WORK;type=VOICE:09 8765 4321
TEL;type=WORK;type=VOICE:4569871230
item2.ADR;type=HOME;type=pref:;;\n1 A;B;Sa;1234;Australia
item2.X-ABADR:au
item3.ADR;type=HOME:;;C\nD;E;Fg;4321;Australia
item3.X-ABADR:au
REV:2018-12-31T13:56:07Z
UID:ADAA51AA-339F-49A5-A23F-8F589E966E8D
END:VCARD

We added compatibility for those custom labels ones some releases ago.
Closing