Defect #31549 » fixed-31549.patch
| app/models/mail_handler.rb | ||
|---|---|---|
|
options[:no_permission_check] = (options[:no_permission_check].to_s == '1')
|
||
|
ActiveSupport::Notifications.instrument("receive.action_mailer") do |payload|
|
||
|
mail = Mail.new(raw_mail.b)
|
||
|
mail = Mail.new(Mail::Utilities.binary_unsafe_to_crlf(raw_mail.b))
|
||
|
set_payload_for_mail(payload, mail)
|
||
|
new.receive(mail, options)
|
||
|
end
|
||
| test/fixtures/mail_handler/thunderbird_with_utf8_body_and_lf_lineterminator_and_attachment.eml | ||
|---|---|---|
|
To: redmine@somenet.foo
|
||
|
From: John Smith <JSmith@somenet.foo>
|
||
|
Subject: =?UTF-8?B?44OG44K544OI44Oh44O844Or?=
|
||
|
Message-ID: <cef02a8b-5359-58f3-6403-bc2bb3c93c43@somenet.foo>
|
||
|
Date: Mon, 10 Jun 2019 13:39:21 +0900
|
||
|
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.14; rv:60.0)
|
||
|
Gecko/20100101 Thunderbird/60.7.0
|
||
|
MIME-Version: 1.0
|
||
|
Content-Type: multipart/mixed;
|
||
|
boundary="------------6FE4347B4294DF3B19BB9898"
|
||
|
Content-Language: en-US
|
||
|
This is a multi-part message in MIME format.
|
||
|
--------------6FE4347B4294DF3B19BB9898
|
||
|
Content-Type: text/plain; charset=utf-8; format=flowed
|
||
|
Content-Transfer-Encoding: 8bit
|
||
|
To:redmine
|
||
|
テストメールを送信します。
|
||
|
--------------6FE4347B4294DF3B19BB9898
|
||
|
Content-Type: application/zip; x-mac-type="0"; x-mac-creator="0";
|
||
|
name="test.zip"
|
||
|
Content-Transfer-Encoding: base64
|
||
|
Content-Disposition: attachment;
|
||
|
filename="test.zip"
|
||
|
UEsDBBQAAAAAAE8/xU4Mfn/YBAAAAAQAAAAIAAAAdGVzdC50eHR0ZXN0UEsBAhQAFAAAAAAA
|
||
|
Tz/FTgx+f9gEAAAABAAAAAgAAAAAAAAAAQAgAAAAAAAAAHRlc3QudHh0UEsFBgAAAAABAAEA
|
||
|
NgAAACoAAAAAAA==
|
||
|
--------------6FE4347B4294DF3B19BB9898--
|
||
| test/unit/mail_handler_test.rb | ||
|---|---|---|
|
assert mail.subject.include?('New ticket on a given project')
|
||
|
end
|
||
|
def test_add_issue_with_utf8_body_and_lf_line_terminator_and_attachment
|
||
|
assert_difference 'Issue.count' do
|
||
|
issue = submit_email(
|
||
|
'thunderbird_with_utf8_body_and_lf_lineterminator_and_attachment.eml',
|
||
|
:issue => {:project => 'ecookbook'}
|
||
|
) do |email|
|
||
|
# Ensure that line terminators are LF
|
||
|
email.gsub!(/\r\n?/, "\n")
|
||
|
end
|
||
|
assert issue.is_a?(Issue)
|
||
|
assert_equal 'テストメール', issue.subject
|
||
|
assert_equal "To:redmine\r\n\r\n テストメールを送信します。", issue.description
|
||
|
assert_equal 1, issue.attachments.size
|
||
|
assert_equal 'test.zip', issue.attachments.first.filename
|
||
|
assert_equal 118, issue.attachments.first.filesize
|
||
|
end
|
||
|
end
|
||
|
def test_created_user_should_be_added_to_groups
|
||
|
group1 = Group.generate!
|
||
|
group2 = Group.generate!
|
||