Merge pull request #10526 from mfo/US/fix-IncompleteParseError

tech(mail_checker): rescue Mail::Field::IncompleteParseError
This commit is contained in:
mfo 2024-06-19 07:03:22 +00:00 committed by GitHub
commit 84caed6c30
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 10 additions and 0 deletions

View file

@ -627,6 +627,8 @@ class EmailChecker
return { success: true } if similar_domains.empty? return { success: true } if similar_domains.empty?
{ success: true, email_suggestions: email_suggestions(parsed_email:, similar_domains:) } { success: true, email_suggestions: email_suggestions(parsed_email:, similar_domains:) }
rescue Mail::Field::IncompleteParseError
return { success: false }
end end
private private

View file

@ -35,5 +35,13 @@ describe EmailCheckerController, type: :controller do
expect(body).to eq({ success: false }) expect(body).to eq({ success: false })
end end
end end
context 'incomplete' do
let(:params) { { email: 'bikram.subedi81@' } }
it do
expect(response).to have_http_status(:success)
expect(body).to eq({ success: false })
end
end
end end
end end