Merge branch 'dont-blow-up-when-email-has-no-references-header' into 'master'
Don't blow up when email has no References header Closes gitlab-ee#2247 See merge request !11014
This commit is contained in:
commit
45f3b0b779
|
@ -0,0 +1,5 @@
|
|||
---
|
||||
title: Gracefully handle failures for incoming emails which do not match on the To
|
||||
header, and have no References header
|
||||
merge_request:
|
||||
author:
|
|
@ -70,6 +70,8 @@ module Gitlab
|
|||
# Handle emails from clients which append with commas,
|
||||
# example clients are Microsoft exchange and iOS app
|
||||
Gitlab::IncomingEmail.scan_fallback_references(references)
|
||||
when nil
|
||||
[]
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -7,9 +7,17 @@ describe Gitlab::Email::Receiver, lib: true do
|
|||
context "when we cannot find a capable handler" do
|
||||
let(:email_raw) { fixture_file('emails/valid_reply.eml').gsub(mail_key, "!!!") }
|
||||
|
||||
it "raises a UnknownIncomingEmail" do
|
||||
it "raises an UnknownIncomingEmail error" do
|
||||
expect { receiver.execute }.to raise_error(Gitlab::Email::UnknownIncomingEmail)
|
||||
end
|
||||
|
||||
context "and the email contains no references header" do
|
||||
let(:email_raw) { fixture_file("emails/auto_reply.eml").gsub(mail_key, "!!!") }
|
||||
|
||||
it "raises an UnknownIncomingEmail error" do
|
||||
expect { receiver.execute }.to raise_error(Gitlab::Email::UnknownIncomingEmail)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
context "when the email is blank" do
|
||||
|
|
Loading…
Reference in New Issue