mirror of
https://github.com/discourse/discourse.git
synced 2025-03-06 11:19:51 +00:00
FIX: Stripping lines from incoming email shouldn't fail for blank body (#10800)
This commit is contained in:
parent
babbebfb35
commit
99181bb3b8
@ -395,7 +395,7 @@ module Email
|
|||||||
text, elided_text, text_format = markdown, elided_markdown, Receiver::formats[:markdown]
|
text, elided_text, text_format = markdown, elided_markdown, Receiver::formats[:markdown]
|
||||||
end
|
end
|
||||||
|
|
||||||
if SiteSetting.strip_incoming_email_lines
|
if SiteSetting.strip_incoming_email_lines && text.present?
|
||||||
in_code = nil
|
in_code = nil
|
||||||
|
|
||||||
text = text.lines.map! do |line|
|
text = text.lines.map! do |line|
|
||||||
|
@ -1549,6 +1549,25 @@ describe Email::Receiver do
|
|||||||
expect(text).to eq(stripped_text)
|
expect(text).to eq(stripped_text)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
it "works with empty mail body" do
|
||||||
|
SiteSetting.strip_incoming_email_lines = true
|
||||||
|
|
||||||
|
email = <<~EOF
|
||||||
|
Date: Tue, 01 Jan 2019 00:00:00 +0300
|
||||||
|
Subject: An email with whitespaces
|
||||||
|
From: Foo <foo@discourse.org>
|
||||||
|
To: bar@discourse.org
|
||||||
|
Content-Type: text/plain; charset="UTF-8"
|
||||||
|
|
||||||
|
--
|
||||||
|
my signature
|
||||||
|
|
||||||
|
EOF
|
||||||
|
|
||||||
|
receiver = Email::Receiver.new(email)
|
||||||
|
text, _elided, _format = receiver.select_body
|
||||||
|
expect(text).to be_blank
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
describe "replying to digest" do
|
describe "replying to digest" do
|
||||||
|
Loading…
x
Reference in New Issue
Block a user