diff --git a/lib/Service/ContactsIntegration.php b/lib/Service/ContactsIntegration.php index da53a72b88..4a976b452d 100644 --- a/lib/Service/ContactsIntegration.php +++ b/lib/Service/ContactsIntegration.php @@ -58,7 +58,15 @@ public function getMatchingRecipient(string $userId, string $term): array { $shareeEnumerationFullMatchUserId = $shareeEnumerationFullMatch && $this->config->getAppValue('core', 'shareapi_restrict_user_enumeration_full_match_userid', 'yes') === 'yes'; $shareeEnumerationFullMatchEmail = $shareeEnumerationFullMatch && $this->config->getAppValue('core', 'shareapi_restrict_user_enumeration_full_match_email', 'yes') === 'yes'; - $result = $this->contactsManager->search($term, ['UID', 'FN', 'EMAIL'], ['enumeration' => $shareeEnumeration, 'fullmatch' => $shareeEnumerationFullMatch]); + $result = $this->contactsManager->search( + $term, + ['UID', 'FN', 'EMAIL'], + [ + 'enumeration' => $shareeEnumeration, + 'fullmatch' => $shareeEnumerationFullMatch, + 'limit' => 20, + ], + ); if (empty($result)) { return []; } diff --git a/tests/Unit/Service/ContactsIntegrationTest.php b/tests/Unit/Service/ContactsIntegrationTest.php index c0dc3b57af..fdfa6f8a5c 100644 --- a/tests/Unit/Service/ContactsIntegrationTest.php +++ b/tests/Unit/Service/ContactsIntegrationTest.php @@ -1,5 +1,7 @@ will($this->returnValue(true)); $this->contactsManager->expects($this->once()) ->method('search') - ->with($term, ['UID', 'FN', 'EMAIL'], ['enumeration' => $allowSystemUsers, 'fullmatch' => $shareeEnumerationFullMatch]) + ->with( + $term, + ['UID', 'FN', 'EMAIL'], + [ + 'enumeration' => $allowSystemUsers, + 'fullmatch' => $shareeEnumerationFullMatch, + 'limit' => 20, + ]) ->will($this->returnValue($searchResult)); }