handle emails with localized headers 😠

This commit is contained in:
Régis Hanol 2017-01-09 22:59:30 +01:00
parent 6b4f265a8c
commit 185dcb2ca1
3 changed files with 32 additions and 21 deletions

View File

@ -239,6 +239,8 @@ module Email
end
def parse_from_field(mail)
return unless mail[:from]
if mail[:from].errors.blank?
mail[:from].address_list.addresses.each do |address_field|
address_field.decoded

View File

@ -383,8 +383,10 @@ describe Email::Receiver do
expect(Post.last.raw).to match(/discourse\.rb/)
end
context "with forwarded emails enabled" do
before { SiteSetting.enable_forwarded_emails = true }
it "handles forwarded emails" do
SiteSetting.enable_forwarded_emails = true
expect { process(:forwarded_email_1) }.to change(Topic, :count)
forwarded_post, last_post = *Post.last(2)
@ -416,6 +418,13 @@ describe Email::Receiver do
expect(last_post.post_type).to eq(Post.types[:whisper])
end
# Who thought this was a good idea?!
it "doesn't blow up with localized email headers" do
expect { process(:forwarded_email_3) }.to change(Topic, :count)
end
end
end
context "new topic in a category" do

Binary file not shown.