nextcloud / nextcloud/contacts

Contact Import Error: VCard object with uid already exists in this addressbook collection.

Open
#3,821 19 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

0. Needs triage bug feature: contacts feature: import
Dominant language
JavaScript
Stars
642
Forks
221
Avg merge
14h 39m
Merged PRs (30d)
51

Description

Describe the bug

Error on importing already existing vcards.

Steps to reproduce
  1. Go to contacts -> contact settings
  2. Click on contact import
  3. Upload File (Toni_Testeroni.vcf):
BEGIN:VCARD
VERSION:3.0
N:Testeroni;Toni;;;
FN:Toni Testeroni
TEL;TYPE=home,voice:+43 123 456789
TEL;TYPE=cell,voice:+43 664 123456789
ADR;TYPE=home:;;Straße 123-456;Ort;;1234;Land
URL;TYPE=home:http://toni.testeroni.com
X-SOCIALPROFILE;TYPE=FACEBOOK:FacebookUser
X-SOCIALPROFILE;TYPE=SKYPE:SkypeUser
X-SOCIALPROFILE;TYPE=LINKEDIN:LinkedInUser
X-SOCIALPROFILE;TYPE=INSTAGRAM:InstagramUser
X-SOCIALPROFILE;TYPE=MASTODON:MastodonUser
BDAY:1990-01-01
EMAIL;TYPE=home:toni.testeroni@mydomain.com
REV:20240222T081751Z
UID:urn:uuid:9130b79c-9f59-456e-a96b-bf633fac5882
END:VCARD
  1. The vcard is successfully imported the first time it is created.
  2. Upload the card again (the error also occurs with the REV field updated to the current timestamp).
  3. See error in Browser Debug Console (Networking Tab)
  • Request:
PUT https://NEXTCLOUD-SERVER-URL/remote.php/dav/addressbooks/users/NEXTCLOUD-USERNAME/NEXTCLOUD-CALENDAR-NAME/F69E2CA2-A5F4-443D-9478-392AC94847E7.vcf
  • Response:
<?xml version="1.0" encoding="utf-8"?>
<d:error xmlns:d="DAV:" xmlns:s="http://sabredav.org/ns">
  <s:exception>Sabre\DAV\Exception\BadRequest</s:exception>
  <s:message>VCard object with uid already exists in this addressbook collection.</s:message>
</d:error>
Expected behavior

Existing vcards shlould be updated.

Actual behavior

Error on import for existing contacts.

Contact version

5.5.2

Operating system

Ubuntu 22.04, Nextcloud Server 28.0.2

PHP engine version

PHP 8.1

Web server

Apache (supported)

Database

MariaDB

Additional info

Without the UID field, the contact will be created twice!

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

No source file or test is named. Reproduce the problem through contacts -> contact settings -> contact import using the provided VCF, then inspect the PUT request and response for the existing UID; done means importing the same card updates the existing contact without an error or duplicate.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, php
Domain
api, backend
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.