From b350c22ebcbb891412e0b334afc9f0db19534e06 Mon Sep 17 00:00:00 2001 From: Joel Hillacre Date: Mon, 26 Jun 2017 15:41:35 -0600 Subject: bpo-30532: Fix whitespace folding in certain cases 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. --- Lib/email/_header_value_parser.py | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) (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 57d01fbcb0f..9b9697f7734 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: -- cgit v1.2.3