From 7a66b3b1da98a0d898d1ca37e10b79a780f3381c Mon Sep 17 00:00:00 2001 From: Jean-Philippe Lang Date: Mon, 10 Jun 2019 11:40:48 +0000 Subject: Issue subject may be broken if the subject field is split into multiple lines (#31365). Patch by Yuichi HARADA. git-svn-id: http://svn.redmine.org/redmine/trunk@18245 e93f8b46-1217-0410-a6f0-8f06a7374b81 --- config/initializers/10-patches.rb | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'config') diff --git a/config/initializers/10-patches.rb b/config/initializers/10-patches.rb index e0559903b..06edc943a 100644 --- a/config/initializers/10-patches.rb +++ b/config/initializers/10-patches.rb @@ -107,6 +107,20 @@ end require 'mail' +module Mail + class SubjectField + # Fixed that the issue subject may be broken if the subject field in the + # receiving email is split into multiple lines + def initialize(value = nil, charset = 'utf-8') + if mime_encode = /^(=\?\S+\?\S\?)/.match(value).to_a[1] + value.gsub!(/\?=\s+#{Regexp.escape(mime_encode)}/, '') + end + self.charset = charset + super(CAPITALIZED_FIELD, value, charset) + end + end +end + module DeliveryMethods class TmpFile def initialize(*args); end -- cgit v1.2.3