Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Revert "Fix sync errors for card creation with the same uri from different sources" #36131

Merged
merged 1 commit into from
Jan 13, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 1 addition & 3 deletions apps/dav/lib/CardDAV/Converter.php
Original file line number Diff line number Diff line change
Expand Up @@ -47,14 +47,12 @@ public function createCardFromUser(IUser $user): ?VCard {
$userProperties = $this->accountManager->getAccount($user)->getProperties();

$uid = $user->getUID();
$backendClassName = $user->getBackendClassName();
$cloudId = $user->getCloudId();
$image = $this->getAvatarImage($user);

$vCard = new VCard();
$vCard->VERSION = '3.0';
$vCard->UID = md5("$backendClassName:$uid");
$vCard->add(new Text($vCard, 'X-NEXTCLOUD-UID', $uid));
$vCard->UID = $uid;

$publish = false;

Expand Down
2 changes: 1 addition & 1 deletion apps/dav/lib/CardDAV/SyncService.php
Original file line number Diff line number Diff line change
Expand Up @@ -274,7 +274,7 @@ public function syncInstance(\Closure $progressCallback = null) {
$allCards = $this->backend->getCards($systemAddressBook['id']);
foreach ($allCards as $card) {
$vCard = Reader::read($card['carddata']);
$uid = isset($vCard->{'X-NEXTCLOUD-UID'}) ? $vCard->{'X-NEXTCLOUD-UID'}->getValue() : $vCard->UID->getValue();
$uid = $vCard->UID->getValue();

Check notice

Code scanning / Psalm

PossiblyNullReference

Cannot call method getValue on possibly null value
// load backend and see if user exists
if (!$this->userManager->userExists($uid)) {
$this->deleteUser($card['uri']);
Expand Down