Skip to content

Commit

Permalink
Merge pull request #39450 from nextcloud/backport/38907/stable26
Browse files Browse the repository at this point in the history
[stable26] Fix: ContactManager search with fullmatch
  • Loading branch information
blizzz committed Aug 3, 2023
2 parents e3b3a81 + 38ba696 commit 1f206dc
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 1f206dc

Please sign in to comment.