summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorArthur Schiwon <blizzz@arthur-schiwon.de>2024-01-18 11:13:11 +0100
committerGitHub <noreply@github.com>2024-01-18 11:13:11 +0100
commitc16744c70f4acdf20788ecfe0b169500a52eba2e (patch)
tree4406686ae43b13eafdf4074a82627dee972e4cc0 /lib
parent0f3af00334fbfd748938a7cd65ad0982fbf9e67b (diff)
parent2a386f8360fba42a22c7243f4eaa3d148538839c (diff)
downloadnextcloud-server-c16744c70f4acdf20788ecfe0b169500a52eba2e.tar.gz
nextcloud-server-c16744c70f4acdf20788ecfe0b169500a52eba2e.zip
Merge pull request #42899 from nextcloud/backport/42860/stable28
[stable28] Update ContactsStore: Avoid exceptions on empties
Diffstat (limited to 'lib')
-rw-r--r--lib/private/Contacts/ContactsMenu/ContactsStore.php13
1 files changed, 7 insertions, 6 deletions
diff --git a/lib/private/Contacts/ContactsMenu/ContactsStore.php b/lib/private/Contacts/ContactsMenu/ContactsStore.php
index eeb6ae56bc1..25a90e5f0f7 100644
--- a/lib/private/Contacts/ContactsMenu/ContactsStore.php
+++ b/lib/private/Contacts/ContactsMenu/ContactsStore.php
@@ -334,14 +334,15 @@ class ContactsStore implements IContactsStore {
private function contactArrayToEntry(array $contact): Entry {
$entry = new Entry();
- if (isset($contact['UID'])) {
+ if (!empty($contact['UID'])) {
$uid = $contact['UID'];
$entry->setId($uid);
$entry->setProperty('isUser', false);
+ // overloaded usage so leaving as-is for now
if (isset($contact['isLocalSystemBook'])) {
$avatar = $this->urlGenerator->linkToRouteAbsolute('core.avatar.getAvatar', ['userId' => $uid, 'size' => 64]);
$entry->setProperty('isUser', true);
- } elseif (isset($contact['FN'])) {
+ } elseif (!empty($contact['FN'])) {
$avatar = $this->urlGenerator->linkToRouteAbsolute('core.GuestAvatar.getAvatar', ['guestName' => $contact['FN'], 'size' => 64]);
} else {
$avatar = $this->urlGenerator->linkToRouteAbsolute('core.GuestAvatar.getAvatar', ['guestName' => $uid, 'size' => 64]);
@@ -349,23 +350,23 @@ class ContactsStore implements IContactsStore {
$entry->setAvatar($avatar);
}
- if (isset($contact['FN'])) {
+ if (!empty($contact['FN'])) {
$entry->setFullName($contact['FN']);
}
$avatarPrefix = "VALUE=uri:";
- if (isset($contact['PHOTO']) && str_starts_with($contact['PHOTO'], $avatarPrefix)) {
+ if (!empty($contact['PHOTO']) && str_starts_with($contact['PHOTO'], $avatarPrefix)) {
$entry->setAvatar(substr($contact['PHOTO'], strlen($avatarPrefix)));
}
- if (isset($contact['EMAIL'])) {
+ if (!empty($contact['EMAIL'])) {
foreach ($contact['EMAIL'] as $email) {
$entry->addEMailAddress($email);
}
}
// Provide profile parameters for core/src/OC/contactsmenu/contact.handlebars template
- if (isset($contact['UID']) && isset($contact['FN'])) {
+ if (!empty($contact['UID']) && !empty($contact['FN'])) {
$targetUserId = $contact['UID'];
$targetUser = $this->userManager->get($targetUserId);
if (!empty($targetUser)) {