mirror of
https://github.com/discourse/discourse.git
synced 2025-02-25 18:55:32 -06:00
FIX: Parse address lists in embedded emails (#14514)
Same fix is applied to emails immediately after being parsed because long headers are sometimes in an invalid format.
This commit is contained in:
@@ -2024,4 +2024,12 @@ describe Email::Receiver do
|
||||
expect { receive(email_3) }.to change { Topic.count }.by(0).and change { Post.where(post_type: Post.types[:regular]).count }.by(1)
|
||||
end
|
||||
end
|
||||
|
||||
it 'fixes valid addresses in embedded emails' do
|
||||
Fabricate(:group, incoming_email: "group-fwd@example.com")
|
||||
process(:long_embedded_email_headers)
|
||||
incoming_email = IncomingEmail.find_by(message_id: "example1@mail.gmail.com")
|
||||
expect(incoming_email.cc_addresses).to include("a@example.com")
|
||||
expect(incoming_email.cc_addresses).to include("c@example.com")
|
||||
end
|
||||
end
|
||||
|
||||
21
spec/fixtures/emails/long_embedded_email_headers.eml
vendored
Normal file
21
spec/fixtures/emails/long_embedded_email_headers.eml
vendored
Normal file
@@ -0,0 +1,21 @@
|
||||
MIME-Version: 1.0
|
||||
Date: Sat, 2 Oct 2021 21:52:36 -0400
|
||||
Message-ID: <example1@mail.gmail.com>
|
||||
Subject: Fwd: Test Email
|
||||
From: Example Group <group@example.com>
|
||||
To: group-fwd@example.com
|
||||
Cc: C <c@example.com>, D <d@
|
||||
example.com>
|
||||
|
||||
|
||||
---------- Forwarded message ---------
|
||||
Date: Sat, 2 Oct 2021 21:52:36 -0400
|
||||
Message-ID: <example2@mail.gmail.com>
|
||||
Subject: Test Email
|
||||
From: User <user@example.com>
|
||||
To: Example Group <group@example.com>
|
||||
Cc: A <a@example.com>, B <
|
||||
b@example.com>
|
||||
|
||||
|
||||
Hello world!
|
||||
Reference in New Issue
Block a user