Skip to content

Commit

Permalink
fix: handle missing email in contact check
Browse files Browse the repository at this point in the history
Signed-off-by: Hamza Mahjoubi <[email protected]>
  • Loading branch information
hamza221 committed Aug 15, 2024
1 parent b881dd9 commit eb11824
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lib/Service/ContactsIntegration.php
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,7 @@ private function doSearch(string $term, array $fields, bool $strictSearch, bool
}
$id = $r['UID'];
$fn = $r['FN'];
$email = $r['EMAIL'];
$email = $r['EMAIL'] ?? null;
$matches[] = [
'id' => $id,
'label' => $fn,
Expand Down
3 changes: 3 additions & 0 deletions lib/Service/PhishingDetection/ContactCheck.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,9 @@ public function run(string $fn, string $email): PhishingDetectionResult {
$emails = [];
$contacts = $this->contactIntegration->getContactsWithName($fn, true);
foreach ($contacts as $contact) {
if(!isset($contact['email'])) {
continue;
}
foreach ($contact['email'] as $contactEmail) {
$emails[] = $contactEmail;
if (strcasecmp($contactEmail, $email) == 0) {
Expand Down

0 comments on commit eb11824

Please sign in to comment.