]> source.dussan.org Git - nextcloud-server.git/commitdiff
Improve email search results 35097/head
authorJoas Schilling <coding@schilljs.com>
Fri, 11 Nov 2022 08:44:24 +0000 (09:44 +0100)
committerJoas Schilling <coding@schilljs.com>
Fri, 9 Dec 2022 21:40:47 +0000 (22:40 +0100)
Signed-off-by: Joas Schilling <coding@schilljs.com>
lib/private/Collaboration/Collaborators/MailPlugin.php

index d34d9fb0087a6ac23fe3c5bbc41d568aa9c6855d..aa317ec17204f8a30855717026c2f3cc27780dcf 100644 (file)
@@ -101,6 +101,12 @@ class MailPlugin implements ISearchPlugin {
                        return false;
                }
 
+               // Extract the email address from "Foo Bar <foo.bar@example.tld>" and then search with "foo.bar@example.tld" instead
+               $result = preg_match('/<([^@]+@.+)>$/', $search, $matches);
+               if ($result && filter_var($matches[1], FILTER_VALIDATE_EMAIL)) {
+                       return $this->search($matches[1], $limit, $offset, $searchResult);
+               }
+
                $currentUserId = $this->userSession->getUser()->getUID();
 
                $result = $userResults = ['wide' => [], 'exact' => []];