[issue27010] email library could "recover" from bad mime boundary like (some?) email clients do

R. David Murray report at bugs.python.org
Wed Sep 7 16:14:38 EDT 2016


R. David Murray added the comment:

Andrea: yes, your patch is different from what I had in mind.  The idea would be to recognize the "nested part with duplicate boundary", register the new defect, but produce a Message object with a structure that looked like this:

  multipart/mixed
    multipart/alternative
        text/plain
        text/html
    image/gif

What your patch produces is:

  multipart/mixed
    multipart/alternative
    text/plain
    text/html

which is not recognizing the nested multipart or the final MIME part (which is the OPs goal).

In principle it should be possible to parse the nesting despite the bad boundary (other MIME parsers do it, as documented here), but I'm not sure how hard it will be to modify Feedparser to do it.  Looking at the code it seems like it shouldn't be that hard to make it work, but I haven't dug deeply enough to be sure.

----------

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue27010>
_______________________________________


More information about the Python-bugs-list mailing list