sync-engine
sync-engine copied to clipboard
message/rfc822 part containing text/html subpart incorrectly gets used as body (despite content_disposition being 'attachment')
Hi all,
Today I had received an Email, that has two parts:
text/plainmessage/rfc822withContent-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/plainis used as the message body- An attachment EML is created (with the filename being set to the contained emails Subject)
What actually happened:
text/plainpart was discardedmessage/rfc822had the containedtext/htmlpart 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