Join GitHub today
GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together.
Sign upbpo-27321 Fix email.generator.py to not replace a non-existent header. #18074
Conversation
…tent header.
This comment has been minimized.
This comment has been minimized.
peteroupc
commented
Jan 20, 2020
Note that the email message example in the issue you linked has no MIME-Version header field. Thus, its interpretation is effectively outside the scope of MIME. As RFC 2045 sec. 4 says:
|
This comment has been minimized.
This comment has been minimized.
@peteroupc I'm not sure I understand what you are trying to say in your comment. If you are saying the issue is invalid because the message attached to the bug report had no MIME-Version header, that was the actual message that caused the issue and the issue occurs whether or not the message contains a MIME-Version header. If you are saying something else, I don't understand what? It is arguably correct that messages which cause this exception to be thrown are not valid messages, but they exist in the wild and should not cause the exception. In any case, I added a MIME-Version: header to the test message in this PR, but it makes no difference. The test passes with the fix and throws the exception without it. |
This comment has been minimized.
This comment has been minimized.
peteroupc
commented
Jan 20, 2020
Since the header field makes no difference, my previous comment is irrelevant. |
msapiro commentedJan 20, 2020
•
edited by bedevere-bot
This PR replaces #1977. The reason for the replacement is two-fold.
The fix itself is different is that if the CTE header doesn't exist in the original message, it is inserted. This is important because the new CTE could be quoted-printable whereas the original is implicit 8bit.
Also the tests are different. The test_nonascii_as_string_without_cte test in #1977 doesn't actually test the issue in that it passes without the fix. The test_nonascii_as_string_without_content_type_and_cte test is improved here, and even though it doesn't fail without the fix, it is included for completeness.
https://bugs.python.org/issue27321