FIX: Prevent Email Processor errors when mail is blank or nil (#21292)

Currently processing emails that are blank or have a nil value for the mail will cause several errors.

This update allows emails with blank body or missing sender to log the blank email error to the mail logs rather than throwing an error.
This commit is contained in:
David Battersby
2023-05-18 10:39:37 +08:00
committed by GitHub
parent 4ec9a947dc
commit 1de8361d2e
2 changed files with 9 additions and 2 deletions

View File

@ -48,6 +48,13 @@ RSpec.describe Email::Processor do
end
end
describe "when mail is not set" do
it "does not raise an error" do
expect { Email::Processor.process!(nil) }.not_to raise_error
expect { Email::Processor.process!("") }.not_to raise_error
end
end
describe "rate limits" do
let(:mail) { "From: #{from}\nTo: bar@foo.com\nSubject: FOO BAR\n\nFoo foo bar bar?" }
let(:limit_exceeded) { RateLimiter::LimitExceeded.new(10) }