summaryrefslogtreecommitdiffstats
path: root/Lib/email
diff options
context:
space:
mode:
authorJoel Hillacre <joel@403forbidden.ca>2017-07-06 21:28:22 (GMT)
committerR. David Murray <rdmurray@bitdance.com>2017-07-06 21:28:22 (GMT)
commitc60d2f5e8609b040ab58c498fde23928fe9dbef5 (patch)
tree925a24e69470d5510367f338de36f7bc35c52117 /Lib/email
parent5d2550cd2ef26c3f5625ab5a1afe3269e44dcb8f (diff)
downloadcpython-c60d2f5e8609b040ab58c498fde23928fe9dbef5.zip
cpython-c60d2f5e8609b040ab58c498fde23928fe9dbef5.tar.gz
cpython-c60d2f5e8609b040ab58c498fde23928fe9dbef5.tar.bz2
bpo-30532: Fix whitespace folding in certain cases (#2591)
Leading whitespace was incorrectly dropped during folding of certain lines in the _header_value_parser's folding algorithm. This makes the whitespace handling code consistent.
Diffstat (limited to 'Lib/email')
-rw-r--r--Lib/email/_header_value_parser.py4
1 files changed, 1 insertions, 3 deletions
diff --git a/Lib/email/_header_value_parser.py b/Lib/email/_header_value_parser.py
index 57d01fb..9b9697f 100644
--- a/Lib/email/_header_value_parser.py
+++ b/Lib/email/_header_value_parser.py
@@ -341,9 +341,7 @@ class TokenList(list):
# avoid infinite recursion.
ws = part.pop_leading_fws()
if ws is not None:
- # Peel off the leading whitespace and make it sticky, to
- # avoid infinite recursion.
- folded.stickyspace = str(part.pop(0))
+ folded.stickyspace = str(ws)
if folded.append_if_fits(part):
continue
if part.has_fws: