Skip to content

Commit 4228fc5

Browse files
committed
fixup! Fix sync errors for duplicate cards with the same UID for different backends
1 parent 78dc079 commit 4228fc5

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

apps/dav/lib/CardDAV/Converter.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,13 +47,13 @@ public function createCardFromUser(IUser $user): ?VCard {
4747
$userProperties = $this->accountManager->getAccount($user)->getProperties();
4848

4949
$uid = $user->getUID();
50-
$name = $user->getBackendClassName();
50+
$backendClassName = $user->getBackendClassName();
5151
$cloudId = $user->getCloudId();
5252
$image = $this->getAvatarImage($user);
5353

5454
$vCard = new VCard();
5555
$vCard->VERSION = '3.0';
56-
$vCard->UID = "$name:$uid";
56+
$vCard->UID = "$backendClassName:$uid";
5757
$vCard->add(new Text($vCard, 'X-NEXTCLOUD-UID', $uid));
5858

5959
$publish = false;

apps/dav/lib/CardDAV/SyncService.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -329,7 +329,7 @@ public function syncInstance(\Closure $progressCallback = null) {
329329
$allCards = $this->backend->getCards($systemAddressBook['id']);
330330
foreach ($allCards as $card) {
331331
$vCard = Reader::read($card['carddata']);
332-
$uid = $vCard->{'X-NEXTCLOUD-UID'}->getValue();
332+
$uid = $vCard->{'X-NEXTCLOUD-UID'}->getValue() ?? $vCard->{'UID'}->getValue();
333333
// load backend and see if user exists
334334
if (!$this->userManager->userExists($uid)) {
335335
$this->deleteUser($card['uri']);

0 commit comments

Comments
 (0)