From a63908c5eda2747eb40c6880d7b04ee8b706d9fe Mon Sep 17 00:00:00 2001 From: Jean-Philippe Lang Date: Tue, 7 Mar 2017 17:54:09 +0000 Subject: Emails with no text or html Content not handled properly (#25269, #25256). MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Patch by Felix Schäfer. git-svn-id: http://svn.redmine.org/redmine/trunk@16379 e93f8b46-1217-0410-a6f0-8f06a7374b81 --- .../mail_handler/empty_text_and_html_part.eml | 35 ++++++++++++++++++++++ test/unit/mail_handler_test.rb | 5 ++++ 2 files changed, 40 insertions(+) create mode 100644 test/fixtures/mail_handler/empty_text_and_html_part.eml (limited to 'test') diff --git a/test/fixtures/mail_handler/empty_text_and_html_part.eml b/test/fixtures/mail_handler/empty_text_and_html_part.eml new file mode 100644 index 000000000..744a3f614 --- /dev/null +++ b/test/fixtures/mail_handler/empty_text_and_html_part.eml @@ -0,0 +1,35 @@ +From JSmith@somenet.foo Fri Mar 22 08:30:28 2013 +From: John Smith +Content-Type: multipart/mixed; boundary="Apple-Mail=_33C8180A-B097-4B87-A925-441300BDB9C9" +Message-Id: +Mime-Version: 1.0 (Mac OS X Mail 6.3 \(1503\)) +Subject: Test with an empty text part +Date: Fri, 22 Mar 2013 17:30:20 +0200 +To: redmine@somenet.foo +X-Mailer: Apple Mail (2.1503) + + + +--Apple-Mail=_33C8180A-B097-4B87-A925-441300BDB9C9 +Content-Transfer-Encoding: quoted-printable +Content-Type: text/plain; + charset=us-ascii + + +--Apple-Mail=_33C8180A-B097-4B87-A925-441300BDB9C9 +Content-Transfer-Encoding: quoted-printable +Content-Type: text/html; + charset=us-ascii + + + + + + + + + + + +--Apple-Mail=_33C8180A-B097-4B87-A925-441300BDB9C9-- diff --git a/test/unit/mail_handler_test.rb b/test/unit/mail_handler_test.rb index 73040f766..5f0b3e3e0 100644 --- a/test/unit/mail_handler_test.rb +++ b/test/unit/mail_handler_test.rb @@ -628,6 +628,11 @@ class MailHandlerTest < ActiveSupport::TestCase assert_equal 'The html part.', issue.description end + def test_empty_text_and_html_part_should_make_an_empty_description + issue = submit_email('empty_text_and_html_part.eml', :issue => {:project => 'ecookbook'}) + assert_equal '', issue.description + end + def test_attachment_text_part_should_be_added_as_issue_attachment issue = submit_email('multiple_text_parts.eml', :issue => {:project => 'ecookbook'}) assert_not_include 'Plain text attachment', issue.description -- cgit v1.2.3