Skip to content

Commit

Permalink
fix(mail): ContactManager search with fullmatch
Browse files Browse the repository at this point in the history
Signed-off-by: Johannes Merkel <mail@johannesgge.de>
  • Loading branch information
JohannesGGE authored and blizzz committed Aug 2, 2023
1 parent f361b5e commit 38ba696
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions lib/private/ContactsManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 38ba696

Please sign in to comment.