summaryrefslogtreecommitdiffstats
path: root/Lib/email/_header_value_parser.py
diff options
context:
space:
mode:
authorAbhilash Raj <maxking@users.noreply.github.com>2019-06-11 23:27:06 (GMT)
committerMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>2019-06-11 23:27:06 (GMT)
commit0745cc66db3acbe7951073071cf063db6337dd10 (patch)
tree7b024e7ce75fb3a3e9603770a620b2adbcd1e967 /Lib/email/_header_value_parser.py
parent22e8a6d013c14f8724f396011fe22f13ea1641aa (diff)
downloadcpython-0745cc66db3acbe7951073071cf063db6337dd10.zip
cpython-0745cc66db3acbe7951073071cf063db6337dd10.tar.gz
cpython-0745cc66db3acbe7951073071cf063db6337dd10.tar.bz2
[3.7] bpo-36520: Email header folded incorrectly (GH-13608) (GH-13910)
* [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/_header_value_parser.py')
-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 18aecbf..fc00b4a 100644
--- a/Lib/email/_header_value_parser.py
+++ b/Lib/email/_header_value_parser.py
@@ -2683,6 +2683,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.