]> source.dussan.org Git - redmine.git/commitdiff
Ensure that vendor-defined characters in ISO-2022-JP email subject don't break issue...
authorGo MAEDA <maeda@farend.jp>
Mon, 15 Oct 2018 10:00:18 +0000 (10:00 +0000)
committerGo MAEDA <maeda@farend.jp>
Mon, 15 Oct 2018 10:00:18 +0000 (10:00 +0000)
Patch by Go MAEDA.

git-svn-id: http://svn.redmine.org/redmine/trunk@17596 e93f8b46-1217-0410-a6f0-8f06a7374b81

test/fixtures/mail_handler/subject_japanese_3.eml [new file with mode: 0644]
test/unit/mail_handler_test.rb

diff --git a/test/fixtures/mail_handler/subject_japanese_3.eml b/test/fixtures/mail_handler/subject_japanese_3.eml
new file mode 100644 (file)
index 0000000..710da87
--- /dev/null
@@ -0,0 +1,9 @@
+From: John Smith <JSmith@somenet.foo>
+To: "redmine@somenet.foo" <redmine@somenet.foo>
+Subject: =?iso-2022-jp?B?GyRCLSEbKEIgGyRCNF0/dDt6JUYlOSVIGyhC?=
+Date: Mon, 27 Aug 2018 09:30:00 +0900
+Message-ID: <87C31D42249DD0489D1A1444E3232DD7019D6183@foo.bar>
+
+The subject contains a "CIRCLED DIGIT ONE" character (U+2460).
+It is undefined in ISO-2022-JP but defined in some vendor-extended
+variants such as ISO-2022-JP-MS.
index 51219d65e25b0a043ee879ed36faf4d98ea819a4..e63ab09581360f0fe40ff1284eae6ebccfc5e5aa 100644 (file)
@@ -741,6 +741,20 @@ class MailHandlerTest < ActiveSupport::TestCase
     assert_equal ja, issue.subject
   end
 
+  def test_add_issue_with_iso_2022_jp_ms_subject
+    # The original subject is "① 丸数字テスト".
+    # CIRCLED DIGIT ONE character is undefined in ISO-2022-JP but
+    # defined in some vendor-extended variants such as ISO-2022-JP-MS.
+    # This test makes sure that mail gem replaces an undefined characters
+    # with a replacement character instead of breaking the whole subject.
+    issue = submit_email(
+              'subject_japanese_3.eml',
+              :issue => {:project => 'ecookbook'}
+            )
+    assert_kind_of Issue, issue
+    assert_match /丸数字テスト/, issue.subject
+  end
+
   def test_should_ignore_emails_from_locked_users
     User.find(2).lock!