-
Notifications
You must be signed in to change notification settings - Fork 96
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
treat message/global as an embedded message per RFC6532
Fixes #602.
- Loading branch information
Showing
4 changed files
with
69 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
Return-Path: <[email protected]> | ||
From: Sender <[email protected]> | ||
To: <[email protected]> | ||
Subject: Email with embedded message | ||
MIME-Version: 1.0 | ||
Content-Type: multipart/mixed; boundary="----------=_4F506AC2.EE281DC4" | ||
Message-Id: <9181f493-df49-4af5-8ad2-e1a8eb692a98> | ||
Date: Wed, 15 Jul 2020 19:48:41 +0100 | ||
|
||
This is a multi-part message in MIME format. | ||
|
||
------------=_4F506AC2.EE281DC4 | ||
Content-Type: text/plain; charset=iso-8859-1 | ||
Content-Disposition: inline | ||
Content-Transfer-Encoding: 8bit | ||
Example outer message. | ||
------------=_4F506AC2.EE281DC4 | ||
Content-Type: message/global | ||
Content-Transfer-Encoding: 8bit | ||
From: "Embed sender" <[email protected]> | ||
To: <[email protected]> | ||
Subject: Embedded subject line with emoji ✨ | ||
X-heävy-mëtal-ümlaut: yes | ||
Date: Sun, 12 May 2024 17:34:29 +1000 | ||
Example embedded message, with UTF-8 headers. | ||
------------=_4F506AC2.EE281DC4-- | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -344,6 +344,35 @@ def test_embedded_message | |
assert_equal("Second line.", chunks[2].lines[1]) | ||
end | ||
|
||
def test_embedded_message_rfc6532 | ||
source = DummySource.new("sup-test://test_embedded_message_rfc6532") | ||
source.messages = [ fixture_path("embedded-message-rfc6532.eml") ] | ||
|
||
sup_message = Message.build_from_source(source, 0) | ||
|
||
chunks = sup_message.load_from_source! | ||
assert_equal(3, chunks.length) | ||
|
||
assert_equal("Email with embedded message", sup_message.subj) | ||
|
||
assert(chunks[0].is_a? Redwood::Chunk::Text) | ||
assert_equal("Example outer message.", chunks[0].lines[0]) | ||
|
||
assert(chunks[1].is_a? Redwood::Chunk::EnclosedMessage) | ||
assert_equal(4, chunks[1].lines.length) | ||
assert_equal("From: Embed sender <[email protected]>", chunks[1].lines[0]) | ||
assert_equal("To: rcpt2 <[email protected]>", chunks[1].lines[1]) | ||
assert_equal("Date: ", chunks[1].lines[2][0..5]) | ||
assert_equal( | ||
Time.rfc2822("Sun, 12 May 2024 17:34:29 +1000"), | ||
Time.rfc2822(chunks[1].lines[2][6..-1]) | ||
) | ||
assert_equal("Subject: Embedded subject line with emoji ✨", chunks[1].lines[3]) | ||
|
||
assert(chunks[2].is_a? Redwood::Chunk::Text) | ||
assert_equal("Example embedded message, with UTF-8 headers.", chunks[2].lines[0]) | ||
end | ||
|
||
def test_malicious_attachment_names | ||
source = DummySource.new("sup-test://test_blank_header_lines") | ||
source.messages = [ fixture_path('malicious-attachment-names.eml') ] | ||
|