Skip to content

Commit

Permalink
fix: adding simple email check to prevent wrong email address sync
Browse files Browse the repository at this point in the history
  • Loading branch information
JannikZed committed Oct 18, 2023
1 parent 9a08cf7 commit 720231c
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions pkg/integration-kencove-api/src/contacts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,14 @@ export class KencoveApiAppContactSyncService {
}
const email = contact.email.toLowerCase();

// simple check if email is actually a valid email address, using regex
if (!email.match(/^[^\s@]+@[^\s@]+\.[^\s@]+$/)) {
this.logger.warn(
`Skipping contact with invalid email address: ${email}`,
);
continue;
}

const companyName = contact.companyname;
const companyNameNormalized = normalizeStrings.companyNames(
companyName || "",
Expand Down

1 comment on commit 720231c

@vercel
Copy link

@vercel vercel bot commented on 720231c Oct 18, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.