mirror of
https://github.com/coddingtonbear/django-mailbox.git
synced 2026-07-09 22:38:19 +02:00
Fix parse UTF-8 filename - close #104
This commit is contained in:
parent
e364369643
commit
f32c0dd245
3 changed files with 92 additions and 0 deletions
|
|
@ -113,6 +113,37 @@ class TestProcessEmail(EmailMessageTestCase):
|
|||
u'\xc3\xb0\xcc\x9eo\xce\xb2\xcc\x9ele.png',
|
||||
)
|
||||
|
||||
def test_message_with_utf8_attachment_header(self):
|
||||
""" Ensure that we properly handle UTF-8 encoded attachment
|
||||
|
||||
Safe for regress of #104 too
|
||||
"""
|
||||
email_object = self._get_email_object(
|
||||
'message_with_utf8_attachment.eml',
|
||||
)
|
||||
mailbox = Mailbox.objects.create()
|
||||
msg = mailbox.process_incoming_message(email_object)
|
||||
|
||||
expected_count = 2
|
||||
actual_count = msg.attachments.count()
|
||||
|
||||
self.assertEqual(
|
||||
expected_count,
|
||||
actual_count,
|
||||
)
|
||||
|
||||
attachment = msg.attachments.all()[0]
|
||||
self.assertEqual(
|
||||
attachment.get_filename(),
|
||||
u'pi\u0142kochwyty.jpg'
|
||||
)
|
||||
|
||||
attachment = msg.attachments.all()[1]
|
||||
self.assertEqual(
|
||||
attachment.get_filename(),
|
||||
u'odpowied\u017a Burmistrza.jpg'
|
||||
)
|
||||
|
||||
def test_message_get_text_body(self):
|
||||
message = self._get_email_object('multipart_text.eml')
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue