summaryrefslogtreecommitdiffstats
path: root/Lib/email
diff options
context:
space:
mode:
authorAbhilash Raj <maxking@users.noreply.github.com>2019-06-11 23:28:10 (GMT)
committerMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>2019-06-11 23:28:10 (GMT)
commit36eea7af48ca0a1c96b78c82bf95bbd29d2332da (patch)
treec57b35d1c238f67ceabf752a24955b6244cb0ad2 /Lib/email
parent36926df8341827fb2a5323f559daab8e34d33ed8 (diff)
downloadcpython-36eea7af48ca0a1c96b78c82bf95bbd29d2332da.zip
cpython-36eea7af48ca0a1c96b78c82bf95bbd29d2332da.tar.gz
cpython-36eea7af48ca0a1c96b78c82bf95bbd29d2332da.tar.bz2
[3.8] bpo-36520: Email header folded incorrectly (GH-13608) (GH-13909)
* [bpo-36520](https://bugs.python.org/issue36520): reset the encoded word offset when starting a new line during an email header folding operation * 📜🤖 Added by blurb_it. * [bpo-36520](https://bugs.python.org/issue36520): add an additional test case, and provide descriptive comments for the test_folding_with_utf8_encoding_* tests * [bpo-36520](https://bugs.python.org/issue36520): fix whitespace issue * [bpo-36520](https://bugs.python.org/issue36520): changes per reviewer request -- remove extraneous backslashes; add whitespace between terminating quotes and line-continuation backslashes; use "bpo-" instead of "issue GH-" in comments (cherry picked from commit f6713e84afc5addcfa8477dbdf2c027787f711c0) Co-authored-by: websurfer5 <49998481+websurfer5@users.noreply.github.com> https://bugs.python.org/issue36520
Diffstat (limited to 'Lib/email')
-rw-r--r--Lib/email/_header_value_parser.py1
1 files changed, 1 insertions, 0 deletions
diff --git a/Lib/email/_header_value_parser.py b/Lib/email/_header_value_parser.py
index 34969ab..308db4d 100644
--- a/Lib/email/_header_value_parser.py
+++ b/Lib/email/_header_value_parser.py
@@ -2768,6 +2768,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.