martinrusev / imbox

Python IMAP for Human beings
MIT License
1.18k stars 188 forks source link

decode_param issue #223

Open rivimey opened 2 years ago

rivimey commented 2 years ago

I saved a bunch of files with this, one of which had a content disposition with a "" value containing a semicolon. The code broke because it tried to interpret the text after the colon as another param, but it isn't, didn't have an '=' in it, and that broke decode_param (unable to unpack split()).

I fixed it for me by changing decode param with:

if not "=" in param:
    return param, ""

and that gave me enough info to work out the actual bug (as above).

I would suggest keeping the check in decode_param, but the proper fix is of course to use a better disposition list splitter, that takes note of double quotes and treats the contents as one unit.