Skip to content

Commit 269df90

Browse files
committed
Improve email search results
Signed-off-by: Joas Schilling <coding@schilljs.com>
1 parent 256fbe9 commit 269df90

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

lib/private/Collaboration/Collaborators/MailPlugin.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,12 @@ public function search($search, $limit, $offset, ISearchResult $searchResult) {
101101
return false;
102102
}
103103

104+
// Extract the email address from "Foo Bar <foo.bar@example.tld>" and then search with "foo.bar@example.tld" instead
105+
$result = preg_match('/<([^@]+@.+)>$/', $search, $matches);
106+
if ($result && filter_var($matches[1], FILTER_VALIDATE_EMAIL)) {
107+
return $this->search($matches[1], $limit, $offset, $searchResult);
108+
}
109+
104110
$currentUserId = $this->userSession->getUser()->getUID();
105111

106112
$result = $userResults = ['wide' => [], 'exact' => []];

0 commit comments

Comments
 (0)