@@ -0,0 +1,14 | |||||
|
1 | From: John Smith <JSmith@somenet.foo> | |||
|
2 | To: "redmine@somenet.foo" <redmine@somenet.foo> | |||
|
3 | Subject: This is a test | |||
|
4 | Content-Type: multipart/alternative; | |||
|
5 | boundary="_c20d9cfa-d16a-43a3-a7e5-71da7877ab23_" | |||
|
6 | ||||
|
7 | --_c20d9cfa-d16a-43a3-a7e5-71da7877ab23_ | |||
|
8 | Content-Type: text/plain; charset="ks_c_5601-1987" | |||
|
9 | Content-Transfer-Encoding: base64 | |||
|
10 | ||||
|
11 | sO24v73AtM+02S4= | |||
|
12 | ||||
|
13 | --_c20d9cfa-d16a-43a3-a7e5-71da7877ab23_-- | |||
|
14 |
@@ -410,7 +410,11 class MailHandler < ActionMailer::Base | |||||
410 | part.header[:content_disposition].try(:disposition_type) == 'attachment' |
|
410 | part.header[:content_disposition].try(:disposition_type) == 'attachment' | |
411 | end |
|
411 | end | |
412 |
|
412 | |||
413 | @plain_text_body = parts.map {|p| Redmine::CodesetUtil.to_utf8(p.body.decoded, p.charset)}.join("\r\n") |
|
413 | @plain_text_body = parts.map do |p| | |
|
414 | body_charset = p.charset.respond_to?(:force_encoding) ? | |||
|
415 | Mail::RubyVer.pick_encoding(p.charset).to_s : p.charset | |||
|
416 | Redmine::CodesetUtil.to_utf8(p.body.decoded, body_charset) | |||
|
417 | end.join("\r\n") | |||
414 |
|
418 | |||
415 | # strip html tags and remove doctype directive |
|
419 | # strip html tags and remove doctype directive | |
416 | if parts.any? {|p| p.mime_type == 'text/html'} |
|
420 | if parts.any? {|p| p.mime_type == 'text/html'} |
@@ -538,6 +538,23 class MailHandlerTest < ActiveSupport::TestCase | |||||
538 | assert_equal ja, issue.subject |
|
538 | assert_equal ja, issue.subject | |
539 | end |
|
539 | end | |
540 |
|
540 | |||
|
541 | def test_add_issue_with_korean_body | |||
|
542 | # Make sure mail bodies with a charset unknown to Ruby | |||
|
543 | # but known to the Mail gem 2.5.4 are handled correctly | |||
|
544 | kr = "\xEA\xB3\xA0\xEB\xA7\x99\xEC\x8A\xB5\xEB\x8B\x88\xEB\x8B\xA4." | |||
|
545 | if !kr.respond_to?(:force_encoding) | |||
|
546 | puts "\nOn Ruby 1.8, skip Korean encoding mail body test" | |||
|
547 | else | |||
|
548 | kr.force_encoding('UTF-8') | |||
|
549 | issue = submit_email( | |||
|
550 | 'body_ks_c_5601-1987.eml', | |||
|
551 | :issue => {:project => 'ecookbook'} | |||
|
552 | ) | |||
|
553 | assert_kind_of Issue, issue | |||
|
554 | assert_equal kr, issue.description | |||
|
555 | end | |||
|
556 | end | |||
|
557 | ||||
541 | def test_add_issue_with_no_subject_header |
|
558 | def test_add_issue_with_no_subject_header | |
542 | issue = submit_email( |
|
559 | issue = submit_email( | |
543 | 'no_subject_header.eml', |
|
560 | 'no_subject_header.eml', |
General Comments 0
You need to be logged in to leave comments.
Login now