summaryrefslogtreecommitdiffstats
path: root/lib/private/Collaboration
diff options
context:
space:
mode:
authorJoas Schilling <coding@schilljs.com>2022-11-11 09:44:24 +0100
committerJoas Schilling <coding@schilljs.com>2022-12-09 22:40:47 +0100
commit269df904a372d747cd1beb1c5bfa282fc3900799 (patch)
tree3fa9bd26753a53b0219fb9a0a85dbd9e91c0afbc /lib/private/Collaboration
parent256fbe9d77f5413bed1bd1a39451daccdbe3517b (diff)
downloadnextcloud-server-269df904a372d747cd1beb1c5bfa282fc3900799.tar.gz
nextcloud-server-269df904a372d747cd1beb1c5bfa282fc3900799.zip
Improve email search results
Signed-off-by: Joas Schilling <coding@schilljs.com>
Diffstat (limited to 'lib/private/Collaboration')
-rw-r--r--lib/private/Collaboration/Collaborators/MailPlugin.php6
1 files changed, 6 insertions, 0 deletions
diff --git a/lib/private/Collaboration/Collaborators/MailPlugin.php b/lib/private/Collaboration/Collaborators/MailPlugin.php
index d34d9fb0087..aa317ec1720 100644
--- a/lib/private/Collaboration/Collaborators/MailPlugin.php
+++ b/lib/private/Collaboration/Collaborators/MailPlugin.php
@@ -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' => []];