]> source.dussan.org Git - redmine.git/commitdiff
allow unicode whitespace after mail handler body delimiters (#17718)
authorToshi MARUYAMA <marutosijp2@yahoo.co.jp>
Tue, 6 Jun 2017 01:34:52 +0000 (01:34 +0000)
committerToshi MARUYAMA <marutosijp2@yahoo.co.jp>
Tue, 6 Jun 2017 01:34:52 +0000 (01:34 +0000)
Contributed by Holger Just and Marius BALTEANU.

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

app/models/mail_handler.rb [changed mode: 0644->0755]
test/fixtures/mail_handler/ticket_on_given_project.eml
test/unit/mail_handler_test.rb

old mode 100644 (file)
new mode 100755 (executable)
index 86ad4eb..5797319
@@ -578,7 +578,7 @@ class MailHandler < ActionMailer::Base
     end
 
     unless delimiters.empty?
-      regex = Regexp.new("^[> ]*(#{ Regexp.union(delimiters) })\s*[\r\n].*", Regexp::MULTILINE)
+      regex = Regexp.new("^[> ]*(#{ Regexp.union(delimiters) })[[:blank:]]*[\r\n].*", Regexp::MULTILINE)
       body = body.gsub(regex, '')
     end
     body.strip
index 7c0fe320852ca574e5ceb951f222acfd0facf297..e311dfbb7ade22f2b0567a354e42f89ea32af6fb 100644 (file)
@@ -10,9 +10,9 @@ Date: Sun, 22 Jun 2008 12:28:07 +0200
 MIME-Version: 1.0
 Content-Type: text/plain;
        format=flowed;
-       charset="iso-8859-1";
+       charset="utf-8";
        reply-type=original
-Content-Transfer-Encoding: 7bit
+Content-Transfer-Encoding: quoted-printable
 X-Priority: 3
 X-MSMail-Priority: Normal
 X-Mailer: Microsoft Outlook Express 6.00.2900.2869
@@ -47,7 +47,7 @@ BREAK
 
 This paragraph is between delimiters.
 
----
+---=C2=A0
 
 This paragraph is after the delimiter so it shouldn't appear.
 
index cbfcfa7ad8b967357bafe6b3a9cdeb415f4de3b4..d5ca795ef9be5f9a1c861081acc1b88ba1a45301 100644 (file)
@@ -963,7 +963,7 @@ class MailHandlerTest < ActiveSupport::TestCase
       assert_issue_created(issue)
       assert issue.description.include?('This paragraph is before delimiters')
       assert issue.description.include?('--- This line starts with a delimiter')
-      assert !issue.description.match(/^---$/)
+      assert !issue.description.match(/^---#{"\u00A0"}$/)
       assert !issue.description.include?('This paragraph is after the delimiter')
     end
   end