martinrusev / imbox

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

Fix crash when semicolon present in attachment name #219

Closed nicknytko closed 2 years ago

nicknytko commented 2 years ago

Fixes crash when ; present in attachment name.

Example content disposition, slightly edited for privacy:

attachment; filename="abcd;efgh;b.jpg";
    size=54924; creation-date="Thu, 10 Mar 2022 20:38:32 GMT";
    modification-date="Thu, 10 Mar 2022 20:38:28 GMT"

This patch splits the content disposition on semicolons, ignoring when it is present inside of a "-delimited string. Should resolve #220

sebix commented 2 years ago

Reminds me of c-like for-loop coding. When it works, it's still better than a bug :)

What would be cool are test cases, so that future changes or re-factoring don't break the compatibility again.