[issue29462] RFC822-comments in email header fields can fool, e.g., get_filename()
Alessandro Vesely
report at bugs.python.org
Mon Feb 6 14:26:07 EST 2017
Alessandro Vesely added the comment:
Neither I found CFWS in rfc2231. In addition, rfc 2045 (Introduction) says that Content-Disposition —where filename is defined— cannot include comments. However, Content-Type can include RFC 822 comments, so the filename should be de-commented in case it is inferred from the name parameter there.
I'm rather new to Python, and sticking to version 2 because of the packages I work with. I see Python3's email has a much more robust design. Does this mean Python2 cannot get fixed?
I attach a de_comment() function, copied from the one I mentioned this morning. The rest of the file shows its intended use. (Oops, it removes comments even from where they are not supposed to be allowed ;-)
Having that kind of functionality in email.utils would make it easier to read Message's, no?
----------
Added file: http://bugs.python.org/file46551/attachments.py
_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue29462>
_______________________________________
More information about the Python-bugs-list
mailing list