Skip to content

fix: use correct Content-Type for vCard PUT requests#83

Merged
SebastianKrupinski merged 1 commit into
nextcloud:mainfrom
stephan1827:fix/vcard-content-type
Jun 25, 2026
Merged

fix: use correct Content-Type for vCard PUT requests#83
SebastianKrupinski merged 1 commit into
nextcloud:mainfrom
stephan1827:fix/vcard-content-type

Conversation

@stephan1827

Copy link
Copy Markdown
Contributor

Summary

  • RFC 6350 defines the media type for vCard data as text/vcard, not application/vcard.
  • application/vcard is not a valid MIME type and causes CardDAV servers that strictly validate the Content-Type (e.g. Fastmail/Cyrus IMAP) to reject PUT requests with 403 Forbidden and a <C:supported-address-data> precondition error.
  • This left newly created or modified contacts in Nextcloud without being synced to the remote server, while the Contacts app showed "Kontakt konnte nicht aktualisiert werden".
  • RemoteEventsService already correctly uses text/calendar; charset=utf-8 for iCalendar — this fix brings RemoteContactsService in line for vCard.

Test plan

  • Connect a Fastmail (or other strict CardDAV) account and enable an address book
  • Create or edit a contact in Nextcloud Contacts within the synced address book
  • Verify the contact is pushed to the remote server without a 403 error

@SebastianKrupinski SebastianKrupinski left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I fixed this in calendar but it seems I missed it in contacts

RFC 6350 defines the media type for vCard data as text/vcard, not
application/vcard. Sending application/vcard causes CardDAV servers
that strictly validate the Content-Type (e.g. Fastmail/Cyrus) to
reject PUT requests with 403 Forbidden / <C:supported-address-data>,
leaving contacts unsynced to the remote server.

Change entityCreate() and entityModify() in RemoteContactsService to
use text/vcard; charset=utf-8, consistent with how RemoteEventsService
already uses text/calendar; charset=utf-8 for iCalendar data.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@stephan1827 stephan1827 force-pushed the fix/vcard-content-type branch from 4ead568 to b723145 Compare June 25, 2026 19:00
@SebastianKrupinski

Copy link
Copy Markdown
Collaborator

DCO was still failing but I merged anyways, just make use you sign the commits properly

@SebastianKrupinski SebastianKrupinski merged commit 64af663 into nextcloud:main Jun 25, 2026
26 of 27 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants