Skip to content

Commit

Permalink
fix: Only error when we verify they're using a disposable domain.
Browse files Browse the repository at this point in the history
  • Loading branch information
zerbitx committed Jan 16, 2025
1 parent 89f43eb commit 646c6b0
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions pkg/cli/email/validate.go
Original file line number Diff line number Diff line change
Expand Up @@ -68,25 +68,25 @@ func Validate(emailAddress string, options ...Option) error {
func checkDisposableDomains(domain string) error {
fb, err := domainsZip.ReadFile("disposable_domains.zip")
if err != nil {
return err
return nil
}

zipReader, err := zip.NewReader(bytes.NewReader(fb), int64(len(fb)))
if err != nil {
return fmt.Errorf("failed to read disposable domains list for verification: %w", err)
return nil
}

for _, file := range zipReader.File {
if file.Name == "disposable_domains.json" {
f, err := file.Open()
if err != nil {
return err
return nil
}
defer f.Close()

var domains []string
if err := json.NewDecoder(f).Decode(&domains); err != nil {
return fmt.Errorf("disposable domains list improperly formatted: %w", err)
return nil
}

if slices.Contains(domains, domain) {
Expand Down

0 comments on commit 646c6b0

Please sign in to comment.