Merge pull request #39450 from nextcloud/backport/38907/stable26

[stable26] Fix: ContactManager search with fullmatch
This commit is contained in:
Arthur Schiwon 2023-08-03 10:59:15 +02:00 committed by GitHub
commit 1f206dc22a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -58,15 +58,18 @@ class ContactsManager implements IManager {
$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;