From 38ba6967293c1bfcf5bb1a4b58a10575ffc5621c Mon Sep 17 00:00:00 2001 From: Johannes Merkel Date: Mon, 19 Jun 2023 18:00:33 +0200 Subject: [PATCH] fix(mail): ContactManager search with fullmatch Signed-off-by: Johannes Merkel --- lib/private/ContactsManager.php | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/lib/private/ContactsManager.php b/lib/private/ContactsManager.php index 5a02968ad9bc5..c39f7c715cc16 100644 --- a/lib/private/ContactsManager.php +++ b/lib/private/ContactsManager.php @@ -58,15 +58,18 @@ public function search($pattern, $searchProperties = [], $options = []) { $strictSearch = array_key_exists('strict_search', $options) && $options['strict_search'] === true; if ($addressBook->isSystemAddressBook()) { + $enumeration = !\array_key_exists('enumeration', $options) || $options['enumeration'] !== false; $fullMatch = !\array_key_exists('fullmatch', $options) || $options['fullmatch'] !== false; - if (!$fullMatch) { - // Neither full match is allowed, so skip the system address book + + if (!$enumeration && !$fullMatch) { + // No access to system address book AND no full match allowed continue; } + if ($strictSearch) { $searchOptions['wildcard'] = false; } else { - $searchOptions['wildcard'] = !\array_key_exists('enumeration', $options) || $options['enumeration'] !== false; + $searchOptions['wildcard'] = $enumeration; } } else { $searchOptions['wildcard'] = !$strictSearch;