aboutsummaryrefslogtreecommitdiffstats
path: root/lib/private/Collaboration/Collaborators
diff options
context:
space:
mode:
authorJoas Schilling <coding@schilljs.com>2022-11-11 09:44:24 +0100
committerbackportbot-nextcloud[bot] <backportbot-nextcloud[bot]@users.noreply.github.com>2022-12-09 22:52:44 +0000
commit9c49de711cad4208333033369ef25c92a39953c3 (patch)
tree9c3d9b51b87133db8e5995a44bf27cae73c9ce53 /lib/private/Collaboration/Collaborators
parent95cbe7440af269c854bd083f8269fe37eb5151fb (diff)
downloadnextcloud-server-9c49de711cad4208333033369ef25c92a39953c3.tar.gz
nextcloud-server-9c49de711cad4208333033369ef25c92a39953c3.zip
Improve email search results
Signed-off-by: Joas Schilling <coding@schilljs.com>
Diffstat (limited to 'lib/private/Collaboration/Collaborators')
-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' => []];