Skip to content

Commit

Permalink
Improve email search results
Browse files Browse the repository at this point in the history
Signed-off-by: Joas Schilling <coding@schilljs.com>
  • Loading branch information
nickvergessen committed Nov 11, 2022
1 parent 58b19e1 commit a005273
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions lib/private/Collaboration/Collaborators/MailPlugin.php
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,12 @@ public function search($search, $limit, $offset, ISearchResult $searchResult) {
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' => []];
Expand Down

0 comments on commit a005273

Please sign in to comment.