Skip to content

Commit

Permalink
Merge pull request #948 from timlrx/fix/email-domain
Browse files Browse the repository at this point in the history
Fix email domain validation
  • Loading branch information
timlrx authored Jun 23, 2024
2 parents 7501b2c + f4476ba commit a2fde6d
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion components/social-icons/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,10 @@ type SocialIconProps = {
}

const SocialIcon = ({ kind, href, size = 8 }: SocialIconProps) => {
if (!href || (kind === 'mail' && !/^mailto:\w+([.-]?\w+)@\w+([.-]?\w+)(.\w{2,3})+$/.test(href)))
if (
!href ||
(kind === 'mail' && !/^mailto:[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$/.test(href))
)
return null

const SocialSvg = components[kind]
Expand Down

0 comments on commit a2fde6d

Please sign in to comment.