mirror of
https://github.com/coddingtonbear/django-mailbox.git
synced 2026-07-09 22:38:19 +02:00
Fix parsing text message with text attachment
This commit is contained in:
parent
4100f2ea62
commit
a673b17fb3
2 changed files with 3 additions and 1 deletions
|
|
@ -401,7 +401,7 @@ class TestProcessEmail(EmailMessageTestCase):
|
||||||
msg = self.mailbox.process_incoming_message(email_object)
|
msg = self.mailbox.process_incoming_message(email_object)
|
||||||
|
|
||||||
self.assertEqual(msg.attachments.all().count(), 1)
|
self.assertEqual(msg.attachments.all().count(), 1)
|
||||||
self.assertNotIn('This is an attachment.', msg.text)
|
self.assertEqual('Has an attached text document, too!', msg.text)
|
||||||
|
|
||||||
def test_message_with_long_content(self):
|
def test_message_with_long_content(self):
|
||||||
email_object = self._get_email_object(
|
email_object = self._get_email_object(
|
||||||
|
|
|
||||||
|
|
@ -108,6 +108,8 @@ def get_body_from_message(message, maintype, subtype):
|
||||||
"""
|
"""
|
||||||
body = six.text_type('')
|
body = six.text_type('')
|
||||||
for part in message.walk():
|
for part in message.walk():
|
||||||
|
if part.get('content-disposition', '').startswith('attachment;'):
|
||||||
|
continue
|
||||||
if part.get_content_maintype() == maintype and \
|
if part.get_content_maintype() == maintype and \
|
||||||
part.get_content_subtype() == subtype:
|
part.get_content_subtype() == subtype:
|
||||||
charset = part.get_content_charset()
|
charset = part.get_content_charset()
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue