[Merge] ubuntu-dev-tools:import-bug-fix into ubuntu-dev-tools:master

Mattia Rizzolo mp+406679 at code.launchpad.net
Wed Aug 4 21:41:58 UTC 2021


Review: Needs Fixing

Right, I think your analysis is correct.

However I think a more formally appropriate fix would be to iterate through the payloads (in case of a multipart message), gather all the inline pieces of text/plain, concatenate them and use the resulting string.  Mails with multiple inline text/plain parts are incredibly rare, but I've seen submitters of Debian bugs doing that to interleave descriptions to attachments.

See an example here: https://bugs.debian.org/981577


Anyway, rather than that `if isinstance()` check, you should be using .is_multipart(), followed by checking with .get_content_type() to verify it's really text/plain.
Everything while looping through .walk().

At the very very least, I'd rather the code gave up if it detected a too complex mail, erroring out saying so.
-- 
https://code.launchpad.net/~ubuntu-dev/ubuntu-dev-tools/+git/ubuntu-dev-tools/+merge/406679
Your team Ubuntu Development Team is subscribed to branch ubuntu-dev-tools:master.




More information about the Ubuntu-reviews mailing list