cpython/Lib/test/test_email
Miss Islington (bot) af35aa2880
[3.13] gh-124452: Fix header mismatches when folding/unfolding with email message (GH-125919) (#126917)
gh-124452: Fix header mismatches when folding/unfolding with email message (GH-125919)

The header-folder of the new email API has a long standing known buglet where
if the first token is longer than max_line_length, it puts that token on the next
line.  It turns out there is also a *parsing* bug when parsing such a header:
the space prefixing that first, non-empty line gets preserved and tacked on to
the start of the header value, which is not the expected behavior per the RFCs.
The bug arises from the fact that the parser assumed that there would be at
least one token on the line with the header, which is going to be true for
probably every email producer other than the python email library with its
folding buglet.  Clearly, though, this is a case that needs to be handled
correctly.  The fix is simple: strip the blanks off the start of the whole
value, not just the first physical line of the value.

(cherry picked from commit ed81971e6b)

Co-authored-by: RanKKI <hliu86.me@gmail.com>
Co-authored-by: blurb-it[bot] <43283697+blurb-it[bot]@users.noreply.github.com>
Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
2024-11-17 15:06:18 -05:00
..
data gh-106186: Don't report MultipartInvariantViolationDefect for valid multipart emails when parsing header only (#107016) 2023-07-23 12:25:18 +02:00
__init__.py
__main__.py
test__encoded_words.py
test__header_value_parser.py [3.13] gh-118643: Fix AttributeError in the email module (GH-119099) (GH-119389) 2024-05-22 14:07:38 +03:00
test_asian_codecs.py
test_contentmanager.py
test_defect_handling.py
test_email.py gh-80361: Fix TypeError in email.Message.get_payload() (GH-117994) 2024-04-17 19:31:26 +03:00
test_generator.py [3.13] gh-121650: Encode newlines in headers, and verify headers are sound (GH-122233) (#122484) 2024-08-06 19:06:41 +02:00
test_headerregistry.py [3.13] gh-92081: Fix for email.generator.Generator with whitespace between encoded words. (GH-92281) (#119245) 2024-05-20 20:01:56 +00:00
test_inversion.py
test_message.py [3.13] gh-124452: Fix header mismatches when folding/unfolding with email message (GH-125919) (#126917) 2024-11-17 15:06:18 -05:00
test_parser.py
test_pickleable.py
test_policy.py [3.13] gh-121650: Encode newlines in headers, and verify headers are sound (GH-122233) (#122484) 2024-08-06 19:06:41 +02:00
test_utils.py gh-113027: Fix timezone check in test_variable_tzname in test_email (GH-113835) 2024-01-12 11:46:17 +01:00
torture_test.py