Kaydet (Commit) 2cae6613 authored tarafından Batuhan Taşkaya's avatar Batuhan Taşkaya

bpo-27737: Allow whitespace only headers encoding

üst f665b96e
......@@ -431,7 +431,7 @@ class _ValueFormatter:
if end_of_line != (' ', ''):
self._current_line.push(*end_of_line)
if len(self._current_line) > 0:
if self._current_line.is_onlyws():
if self._current_line.is_onlyws() and self._lines:
self._lines[-1] += str(self._current_line)
else:
self._lines.append(str(self._current_line))
......
......@@ -4964,6 +4964,9 @@ A very long line that must get split to something other than at the
msg['SomeHeader'] = ' value with leading ws'
self.assertEqual(str(msg), "SomeHeader: value with leading ws\n\n")
def test_whitespace_header(self):
self.assertEqual(Header(' ').encode(), ' ')
# Test RFC 2231 header parameters (en/de)coding
......
Allow whitespace only header encoding in ``email.header`` - by Batuhan
Taskaya
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment