[issue29462] RFC822-comments in email header fields can fool, e.g., get_filename()

R. David Murray report at bugs.python.org
Mon Feb 6 09:17:59 EST 2017


R. David Murray added the comment:

Oh, and the answer to you "why" is that the email package is only dealing with content semantically in address lists.  Everywhere else it is up to the library using program to interpret the structured headers.  In 2.7 the email package provides you the tools to process emails, but does not do very much hand holding.  The python3 email package tries to do a much better job; but, frankly, I skimped on handling comments and have done almost no testing of the code that theoretically handles them, since they are so rarely encountered in the wild.  Specifically they are supposed to be correctly parsed, but there is no way to access comment content and, as I said, there are few to zero tests that include comments to validate that syntactic handling. 

I would be interested in patches to complete the comment support in _header_value_parser in python3.

----------

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


More information about the Python-bugs-list mailing list