Defect #31549 » fixed-31549.patch
app/models/mail_handler.rb | ||
---|---|---|
44 | 44 |
options[:no_permission_check] = (options[:no_permission_check].to_s == '1') |
45 | 45 | |
46 | 46 |
ActiveSupport::Notifications.instrument("receive.action_mailer") do |payload| |
47 |
mail = Mail.new(raw_mail.b)
|
|
47 |
mail = Mail.new(Mail::Utilities.binary_unsafe_to_crlf(raw_mail.b))
|
|
48 | 48 |
set_payload_for_mail(payload, mail) |
49 | 49 |
new.receive(mail, options) |
50 | 50 |
end |
test/fixtures/mail_handler/thunderbird_with_utf8_body_and_lf_lineterminator_and_attachment.eml | ||
---|---|---|
1 |
To: redmine@somenet.foo |
|
2 |
From: John Smith <JSmith@somenet.foo> |
|
3 |
Subject: =?UTF-8?B?44OG44K544OI44Oh44O844Or?= |
|
4 |
Message-ID: <cef02a8b-5359-58f3-6403-bc2bb3c93c43@somenet.foo> |
|
5 |
Date: Mon, 10 Jun 2019 13:39:21 +0900 |
|
6 |
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.14; rv:60.0) |
|
7 |
Gecko/20100101 Thunderbird/60.7.0 |
|
8 |
MIME-Version: 1.0 |
|
9 |
Content-Type: multipart/mixed; |
|
10 |
boundary="------------6FE4347B4294DF3B19BB9898" |
|
11 |
Content-Language: en-US |
|
12 | ||
13 |
This is a multi-part message in MIME format. |
|
14 |
--------------6FE4347B4294DF3B19BB9898 |
|
15 |
Content-Type: text/plain; charset=utf-8; format=flowed |
|
16 |
Content-Transfer-Encoding: 8bit |
|
17 | ||
18 |
To:redmine |
|
19 | ||
20 |
テストメールを送信します。 |
|
21 | ||
22 |
--------------6FE4347B4294DF3B19BB9898 |
|
23 |
Content-Type: application/zip; x-mac-type="0"; x-mac-creator="0"; |
|
24 |
name="test.zip" |
|
25 |
Content-Transfer-Encoding: base64 |
|
26 |
Content-Disposition: attachment; |
|
27 |
filename="test.zip" |
|
28 | ||
29 |
UEsDBBQAAAAAAE8/xU4Mfn/YBAAAAAQAAAAIAAAAdGVzdC50eHR0ZXN0UEsBAhQAFAAAAAAA |
|
30 |
Tz/FTgx+f9gEAAAABAAAAAgAAAAAAAAAAQAgAAAAAAAAAHRlc3QudHh0UEsFBgAAAAABAAEA |
|
31 |
NgAAACoAAAAAAA== |
|
32 |
--------------6FE4347B4294DF3B19BB9898-- |
test/unit/mail_handler_test.rb | ||
---|---|---|
415 | 415 |
assert mail.subject.include?('New ticket on a given project') |
416 | 416 |
end |
417 | 417 | |
418 |
def test_add_issue_with_utf8_body_and_lf_line_terminator_and_attachment |
|
419 |
assert_difference 'Issue.count' do |
|
420 |
issue = submit_email( |
|
421 |
'thunderbird_with_utf8_body_and_lf_lineterminator_and_attachment.eml', |
|
422 |
:issue => {:project => 'ecookbook'} |
|
423 |
) do |email| |
|
424 |
# Ensure that line terminators are LF |
|
425 |
email.gsub!(/\r\n?/, "\n") |
|
426 |
end |
|
427 | ||
428 |
assert issue.is_a?(Issue) |
|
429 |
assert_equal 'テストメール', issue.subject |
|
430 |
assert_equal "To:redmine\r\n\r\n テストメールを送信します。", issue.description |
|
431 | ||
432 |
assert_equal 1, issue.attachments.size |
|
433 |
assert_equal 'test.zip', issue.attachments.first.filename |
|
434 |
assert_equal 118, issue.attachments.first.filesize |
|
435 |
end |
|
436 |
end |
|
437 | ||
418 | 438 |
def test_created_user_should_be_added_to_groups |
419 | 439 |
group1 = Group.generate! |
420 | 440 |
group2 = Group.generate! |