@@ -405,6 +405,11 class MailHandler < ActionMailer::Base | |||||
405 | else |
|
405 | else | |
406 | [email] |
|
406 | [email] | |
407 | end |
|
407 | end | |
|
408 | ||||
|
409 | parts.reject! do |part| | |||
|
410 | part.header[:content_disposition].try(:disposition_type) == 'attachment' | |||
|
411 | end | |||
|
412 | ||||
408 | @plain_text_body = parts.map {|p| Redmine::CodesetUtil.to_utf8(p.body.decoded, p.charset)}.join("\r\n") |
|
413 | @plain_text_body = parts.map {|p| Redmine::CodesetUtil.to_utf8(p.body.decoded, p.charset)}.join("\r\n") | |
409 |
|
414 | |||
410 | # strip html tags and remove doctype directive |
|
415 | # strip html tags and remove doctype directive |
@@ -52,4 +52,11 Content-Type: text/plain; | |||||
52 |
|
52 | |||
53 | The third one. |
|
53 | The third one. | |
54 |
|
54 | |||
|
55 | --Apple-Mail=_33C8180A-B097-4B87-A925-441300BDB9C9 | |||
|
56 | Content-Transfer-Encoding: quoted-printable | |||
|
57 | Content-Type: text/plain; charset=us-ascii | |||
|
58 | Content-Disposition: attachment; filename="textfile.txt" | |||
|
59 | ||||
|
60 | Plain text attachment | |||
|
61 | ||||
55 | --Apple-Mail=_33C8180A-B097-4B87-A925-441300BDB9C9-- |
|
62 | --Apple-Mail=_33C8180A-B097-4B87-A925-441300BDB9C9-- |
@@ -501,13 +501,21 class MailHandlerTest < ActiveSupport::TestCase | |||||
501 | assert_equal 'd8e8fca2dc0f896fd7cb4cb0031ba249', attachment.digest |
|
501 | assert_equal 'd8e8fca2dc0f896fd7cb4cb0031ba249', attachment.digest | |
502 | end |
|
502 | end | |
503 |
|
503 | |||
504 | def test_multiple_text_parts |
|
504 | def test_multiple_inline_text_parts_should_be_appended_to_issue_description | |
505 | issue = submit_email('multiple_text_parts.eml', :issue => {:project => 'ecookbook'}) |
|
505 | issue = submit_email('multiple_text_parts.eml', :issue => {:project => 'ecookbook'}) | |
506 | assert_include 'first', issue.description |
|
506 | assert_include 'first', issue.description | |
507 | assert_include 'second', issue.description |
|
507 | assert_include 'second', issue.description | |
508 | assert_include 'third', issue.description |
|
508 | assert_include 'third', issue.description | |
509 | end |
|
509 | end | |
510 |
|
510 | |||
|
511 | def test_attachment_text_part_should_be_added_as_issue_attachment | |||
|
512 | issue = submit_email('multiple_text_parts.eml', :issue => {:project => 'ecookbook'}) | |||
|
513 | assert_not_include 'Plain text attachment', issue.description | |||
|
514 | attachment = issue.attachments.detect {|a| a.filename == 'textfile.txt'} | |||
|
515 | assert_not_nil attachment | |||
|
516 | assert_include 'Plain text attachment', File.read(attachment.diskfile) | |||
|
517 | end | |||
|
518 | ||||
511 | def test_add_issue_with_iso_8859_1_subject |
|
519 | def test_add_issue_with_iso_8859_1_subject | |
512 | issue = submit_email( |
|
520 | issue = submit_email( | |
513 | 'subject_as_iso-8859-1.eml', |
|
521 | 'subject_as_iso-8859-1.eml', |
General Comments 0
You need to be logged in to leave comments.
Login now