sync-engine icon indicating copy to clipboard operation
sync-engine copied to clipboard

message/rfc822 part containing text/html subpart incorrectly gets used as body (despite content_disposition being 'attachment')

Open tbraeutigam opened this issue 9 years ago • 0 comments

Hi all,

Today I had received an Email, that has two parts:

  1. text/plain
  2. message/rfc822 with Content-Disposition: attachment

The message/rfc822 contained an html email generated by 'Office Communicator conversation history archiver'.

What was supposed to happen (and happens in Outlook Web App):

  • text/plain is used as the message body
  • An attachment EML is created (with the filename being set to the contained emails Subject)

What actually happened:

  • text/plain part was discarded
  • message/rfc822 had the contained text/html part extracted and used as the msg.body
  • A 0 byte attachment named 'Unnamed Attachment' was created

The Problem seems to be with the usage of walk(). Going with a single, standard flanker run (for part in msg.parts: [...]) yields the expected two messages. Using for part in msg.walk(with_self=msg.content_type.is_singlepart()): yields three messages -- the text/html one has been extracted.

The following zip contains the python scripts and example message that illustrate the issue: nylas.zip

Best Regards, Thorben

tbraeutigam avatar Sep 08 '16 16:09 tbraeutigam