From b1dfcd62837674ca20e4a91562374e8e8f7bae2a Mon Sep 17 00:00:00 2001 From: Pete Matsyburka Date: Tue, 26 May 2026 10:30:29 +0300 Subject: [PATCH] fix email typo --- lib/submissions.rb | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/lib/submissions.rb b/lib/submissions.rb index 33081926..c7ba677b 100644 --- a/lib/submissions.rb +++ b/lib/submissions.rb @@ -162,7 +162,7 @@ module Submissions return email.downcase.sub(/@gmail?\z/i, '@gmail.com') if email.match?(/@gmail?\z/i) return email.downcase if email.include?(',') || - email.match?(/\.(?:gob|om|mm|cm|et|mo|nz|za|ie|ed\.jp)\z/i) || + email.match?(/\.(?:gob(?:\.\w+)?|om|mm|cm|et|mo|nz|za|ie|ed\.jp)\z/i) || email.exclude?('.') fixed_email = EmailTypo.call(email.delete_prefix('<')) @@ -175,7 +175,9 @@ module Submissions return email.downcase if domain == fixed_domain return email.downcase if fixed_domain.match?(/\Agmail\.(?!com\z)/i) - if DidYouMean::Levenshtein.distance(domain, fixed_domain) > 3 + threshold = fixed_domain.start_with?('hotmail.') ? 2 : 3 + + if DidYouMean::Levenshtein.distance(domain, fixed_domain) > threshold Rails.logger.info("Skipped email fix #{domain}") return email.downcase