Issue Description
Apple Contacts (macOS and iOS) silently drops a number of cards served over CardDAV. Nothing is logged on the server and the clients show no error: the cards are simply missing.
Setup: single address book with 910 cards, most of them originally created on Apple devices (PRODID macOS 12.3 / iOS 26-27) and later migrated to Stalwart. Bulwark (JMAP) shows all 910 cards; macOS Contacts showed 902 and iOS Contacts 896.
I bisected the missing cards against the raw REPORT output and found three independent causes in the vCard 3.0 serialization, each verified by fixing a single card and watching it reappear on the client:
-
PHOTO with mixed v3/v4 parameters (iOS)
PHOTO;MEDIATYPE=image/jpeg;PROP-ID=m0;ENCODING=b;TYPE=JPEG:/9j/4AAQ…
All 43 cards with a photo were missing on iOS; removing PHOTO made each of them appear immediately. -
ADR is always emitted with the 18-component RFC 9554 layout (and N with 7), also in 3.0. Depending on where the 75-octet fold lands, Apple’s parser rejects the card:
a) macOS + iOS: fold inside the trailing run of empty components (between two ‘;’, or a continuation line made only of ‘;’):
ADR;PREF=1;PROP-ID=a0;JSCOMPS=“s,, ;3;4”:;;;Venezia;Venezia VE;;;;;;;;;;;;
;
All 8 cards missing on macOS matched this; none of the 902 visible cards did.
b) iOS only: fold inside an extended component (ADR component 11, the repeated street line; N component 6):
ADR;TYPE=HOME;PROP-ID=a0;JSCOMPS=“s,, ;11;3;4;5;6”;CHARSET=UTF-8:;;Via Ros
elli Cecconi Mario n° 15;Firenze;FI;50127;Italia;;;;;Via Roselli Cecconi
Mario n° 15;;;;;;
All 9 cards still missing on iOS matched this (4 of the 900 visible cards did too, so it is not 100% deterministic, but rewriting ADR/N as plain 3.0 fixed every one of the 9).
Folding is legal per RFC 6350/2426, so the root bug is arguably in Apple’s parser, but the server can avoid it trivially by emitting only the 3.0 components. -
Other vCard 4.0 / JSContact leftovers in the 3.0 output (909/910 cards). They did not prevent display, but they are not valid 3.0 and some lose data:
- JSCOMPS and PROP-ID parameters on almost every property;
- duplicate PROP-ID within the same card (20 cards), e.g. BDAY;PROP-ID=a0 and ADR;PROP-ID=a0;
- SOCIALPROFILE (4.0 property) instead of Apple’s X-SOCIALPROFILE (108 cards);
- double-escaped colons in URIs: http\://www.google.com/…, xmpp\:name (~130 cards);
- CHARSET=UTF-8 parameter kept (93 cards);
- year-less birthdays: Apple’s BDAY;X-APPLE-OMIT-YEAR=1604:1604-07-10 loses X-APPLE-OMIT-YEAR, so every client now shows the year 1604 (16 cards).
Side note: an iOS account created before the vCard version fix (0.16.9) kept garbled accented names (UTF-8 read as Latin-1, e.g. “PappadÔ) for every card not modified since. Removing and re-adding the account fixed it; maybe worth a line in the upgrade notes.
Expected Behavior
When serving VERSION:3.0 (CardDAV clients that do not request 4.0, such as Apple Contacts), Stalwart should emit valid vCard 3.0 (RFC 2426) that Apple Contacts can parse:
- PHOTO;ENCODING=b;TYPE=JPEG: (no MEDIATYPE, no PROP-ID)
- ADR with the 7 standard components and N with the 5 standard components (no RFC 9554 extended components), so that folding never lands inside empty/extended components
- no 4.0/JSContact-only parameters (JSCOMPS, PROP-ID) and no CHARSET
- Apple-compatible equivalents where they exist: X-SOCIALPROFILE, BDAY;X-APPLE-OMIT-YEAR preserved
- URIs escaped once (http://…, not http\://…)
Actual Behavior
The 3.0 output mixes v3 and v4/JSContact syntax (see Issue Description). Apple Contacts silently discards:
- every card containing PHOTO (iOS);
- cards whose ADR line folds inside the run of empty components (macOS + iOS);
- cards whose ADR/N line folds inside an RFC 9554 extended component (iOS).
No error is returned to the client and nothing is logged, so the user only notices that some contacts are “missing” on Apple devices while they are visible in JMAP clients.
Reproduction Steps
- On an Apple device (or via JMAP), create three contacts in a Stalwart address book:
a) any contact with a photo;
b) a contact whose only address is: city “Venezia”, region “Venezia VE” (nothing else);
c) a contact with a long street, e.g. “Via Roselli Cecconi Mario n° 15”, city “Firenze”, region “FI”, postal code “50127”, country “Italia”. - Fetch the address book with an addressbook-query REPORT and inspect the VERSION:3.0 output:
curl -u user -X REPORT -H “Depth: 1” -H “Content-Type: application/xml”
–data ‘<?xml version="1.0"?><C:addressbook-query xmlns:D=“DAV:” xmlns:C=“urn:ietf:params:xml:ns:carddav”><D:prop><C:address-data/></D:prop></C:addressbook-query>’
https:///dav/card//default/
→ (a) PHOTO;MEDIATYPE=…;ENCODING=b;TYPE=JPEG, (b) ADR folded with a continuation line " ;", (c) ADR folded inside component 11. - Add the CardDAV account in macOS Contacts and iOS Contacts.
- Observe: (a) missing on iOS, (b) missing on macOS and iOS, (c) missing on iOS. All three are visible in Bulwark/JMAP.
Workarounds verified card by card: removing PHOTO; editing the address so the fold moves; or PUTting the card back with plain 3.0 ADR (7 components) and N (5 components) without JSCOMPS/PROP-ID/CHARSET.
Relevant Log Output
No errors are logged by Stalwart (CardDAV requests return 207/200) and Apple Contacts reports nothing.
I can share the raw REPORT responses of the affected cards (anonymised) if useful.
Stalwart Version
v0.16.x
Installation Method
Docker
Database Backend
RocksDB
Blob Storage
RocksDB
Search Engine
Internal
Directory Backend
Internal
I have reviewed the documentation and FAQ and confirm that my issue is NOT addressed there.
on
I have searched this support forum (open and closed topics) and confirm this is not a duplicate.
on
I understand that topics in this category are triaged by a bot first but a human reply will follow up. If I’d prefer a human-only reply, I’ll add the no-ai tag to my topic.
on