mirror of
https://github.com/meineerde/redmine.git
synced 2025-12-19 23:11:12 +00:00
add test which ensure received mail text attachment keeps original encoding (#21742)
This test fails on Ruby >= 2.1 and will be fixed by next revision. Contributed by Pavel Rosický. git-svn-id: http://svn.redmine.org/redmine/trunk@15183 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
parent
3ac315301a
commit
e28cc10a35
31
test/fixtures/mail_handler/ticket_with_text_attachment_iso-8859-2.eml
vendored
Normal file
31
test/fixtures/mail_handler/ticket_with_text_attachment_iso-8859-2.eml
vendored
Normal file
@ -0,0 +1,31 @@
|
|||||||
|
Date: Thu, 14 Jan 2016 18:32:45 +0100
|
||||||
|
From: John Smith <JSmith@somenet.foo>
|
||||||
|
To: redmine@somenet.foo
|
||||||
|
Message-ID: <7A3.L9Yi.1Ki1}PMZiV5.1Mbzkz@seznam.cz>
|
||||||
|
Subject: issue #21742
|
||||||
|
Mime-Version: 1.0
|
||||||
|
Content-Type: multipart/mixed;
|
||||||
|
boundary="=_08d580646981073f1a667ba3=898e56d9-3d29-5ed2-9c9a-cc3a5d9474b5_=";
|
||||||
|
charset=UTF-8
|
||||||
|
Content-Transfer-Encoding: 7bit
|
||||||
|
X-Mailer: szn-ebox-4.5.88
|
||||||
|
|
||||||
|
|
||||||
|
--=_08d580646981073f1a667ba3=898e56d9-3d29-5ed2-9c9a-cc3a5d9474b5_=
|
||||||
|
Content-Type: text/plain;
|
||||||
|
charset=utf-8
|
||||||
|
Content-Transfer-Encoding: base64
|
||||||
|
|
||||||
|
|
||||||
|
--=_08d580646981073f1a667ba3=898e56d9-3d29-5ed2-9c9a-cc3a5d9474b5_=
|
||||||
|
Content-Type: text/plain;
|
||||||
|
charset=UTF-8;
|
||||||
|
name=latin2.txt
|
||||||
|
Content-Transfer-Encoding: quoted-printable
|
||||||
|
Content-Disposition: attachment;
|
||||||
|
filename=latin2.txt;
|
||||||
|
size=19
|
||||||
|
|
||||||
|
p=F8=EDli=B9 =BEluou=E8k=FD k=F9n=
|
||||||
|
|
||||||
|
--=_08d580646981073f1a667ba3=898e56d9-3d29-5ed2-9c9a-cc3a5d9474b5_=--
|
||||||
@ -578,6 +578,22 @@ class MailHandlerTest < ActiveSupport::TestCase
|
|||||||
assert_equal 'd8e8fca2dc0f896fd7cb4cb0031ba249', attachment.digest
|
assert_equal 'd8e8fca2dc0f896fd7cb4cb0031ba249', attachment.digest
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def test_mail_with_attachment_latin2
|
||||||
|
issue = submit_email(
|
||||||
|
'ticket_with_text_attachment_iso-8859-2.eml',
|
||||||
|
:issue => {:project => 'ecookbook'}
|
||||||
|
)
|
||||||
|
assert_kind_of Issue, issue
|
||||||
|
assert_equal 1, issue.attachments.size
|
||||||
|
attachment = issue.attachments.first
|
||||||
|
assert_equal 'latin2.txt', attachment.filename
|
||||||
|
assert_equal 19, attachment.filesize
|
||||||
|
assert File.exist?(attachment.diskfile)
|
||||||
|
assert_equal 19, File.size(attachment.diskfile)
|
||||||
|
content = "p\xF8\xEDli\xB9 \xBEluou\xE8k\xFD k\xF9n".force_encoding('CP852')
|
||||||
|
assert_equal content, File.read(attachment.diskfile).force_encoding('CP852')
|
||||||
|
end
|
||||||
|
|
||||||
def test_multiple_inline_text_parts_should_be_appended_to_issue_description
|
def test_multiple_inline_text_parts_should_be_appended_to_issue_description
|
||||||
issue = submit_email('multiple_text_parts.eml', :issue => {:project => 'ecookbook'})
|
issue = submit_email('multiple_text_parts.eml', :issue => {:project => 'ecookbook'})
|
||||||
assert_include 'first', issue.description
|
assert_include 'first', issue.description
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user