]> source.dussan.org Git - nextcloud-server.git/commitdiff
Principal search by display name case insensitive 31976/head
authorVincent Petry <vincent@nextcloud.com>
Fri, 8 Apr 2022 08:20:24 +0000 (10:20 +0200)
committerbackportbot[bot] <backportbot[bot]@users.noreply.github.com>
Thu, 14 Apr 2022 13:11:04 +0000 (13:11 +0000)
Adjust principal search to be case insensitive even with exact match.
This aligns the behavior to how the search also works in
Collaborators/UserPlugin

Signed-off-by: Vincent Petry <vincent@nextcloud.com>
apps/dav/lib/Connector/Sabre/Principal.php

index 8002f9637988013e2eaa85d6ae8a5d2671878ed8..c3f06f95783a007ca0c1c57d6c776fc2725c9e7b 100644 (file)
@@ -347,9 +347,10 @@ class Principal implements BackendInterface {
 
                                        if (!$allowEnumeration) {
                                                if ($allowEnumerationFullMatch) {
+                                                       $lowerSearch = strtolower($value);
                                                        $users = $this->userManager->searchDisplayName($value, $searchLimit);
-                                                       $users = \array_filter($users, static function (IUser $user) use ($value) {
-                                                               return $user->getDisplayName() === $value;
+                                                       $users = \array_filter($users, static function (IUser $user) use ($lowerSearch) {
+                                                               return strtolower($user->getDisplayName()) === $lowerSearch;
                                                        });
                                                } else {
                                                        $users = [];