mirror of
https://github.com/discourse/discourse.git
synced 2025-05-21 18:12:32 +08:00
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:
@ -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) }
|
||||
|
Reference in New Issue
Block a user