From f6713e84afc5addcfa8477dbdf2c027787f711c0 Mon Sep 17 00:00:00 2001 From: websurfer5 <49998481+websurfer5@users.noreply.github.com> Date: Thu, 6 Jun 2019 12:53:27 -0700 Subject: bpo-36520: Email header folded incorrectly (#13608) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * bpo-36520: reset the encoded word offset when starting a new line during an email header folding operation * 📜🤖 Added by blurb_it. * bpo-36520: add an additional test case, and provide descriptive comments for the test_folding_with_utf8_encoding_* tests * bpo-36520: fix whitespace issue * bpo-36520: changes per reviewer request -- remove extraneous backslashes; add whitespace between terminating quotes and line-continuation backslashes; use "bpo-" instead of "issue #" in comments --- Lib/email/_header_value_parser.py | 1 + 1 file changed, 1 insertion(+) (limited to 'Lib/email/_header_value_parser.py') diff --git a/Lib/email/_header_value_parser.py b/Lib/email/_header_value_parser.py index 35d746aa508..bb5ff8dc7e8 100644 --- a/Lib/email/_header_value_parser.py +++ b/Lib/email/_header_value_parser.py @@ -2789,6 +2789,7 @@ def _refold_parse_tree(parse_tree, *, policy): newline = _steal_trailing_WSP_if_exists(lines) if newline or part.startswith_fws(): lines.append(newline + tstr) + last_ew = None continue if not hasattr(part, 'encode'): # It's not a terminal, try folding the subparts. -- cgit v1.2.3