]> git.ipfire.org Git - thirdparty/Python/cpython.git/commit
bpo-27321 Fix email.generator.py to not replace a non-existent header. (GH-18074)
authorMiss Skeleton (bot) <31488909+miss-islington@users.noreply.github.com>
Mon, 19 Oct 2020 23:07:20 +0000 (16:07 -0700)
committerGitHub <noreply@github.com>
Mon, 19 Oct 2020 23:07:20 +0000 (16:07 -0700)
commit371146a3f8a989964e2a9c0efc7d776815410fac
treeb9f9c702e614b015fafb175c1d034beebf6863b7
parent609a38a36f3006ee00eccc18b25e3b2d577a3e56
bpo-27321 Fix email.generator.py to not replace a non-existent header. (GH-18074)

This PR replaces GH-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 GH-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.

Automerge-Triggered-By: @warsaw
(cherry picked from commit bf838227c35212709dc43b3c3c57f8e1655c1d24)

Co-authored-by: Mark Sapiro <mark@msapiro.net>
Lib/email/generator.py
Lib/test/test_email/test_email.py
Misc/NEWS.d/next/Library/2020-01-19-18-40-26.bpo-27321.8e6SpM.rst [new file with mode: 0644]