BigW Consortium Gitlab

Commit 08b1380f by Sean McGivern

Don't blow up when email has no References header

If an email doesn't match our incoming email patterns on the To header, we fall back to the References header. If there was no References header, we'd raise an exception, when we'd be better off acting as if it was empty.
parent 6277bda6
---
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
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment