mirror of
https://github.com/python/cpython
synced 2024-09-16 00:17:02 +00:00
bpo-27737: Allow whitespace only headers encoding (#13478)
This commit is contained in:
parent
6bc5917903
commit
ef5bb25e2d
|
@ -431,7 +431,7 @@ def newline(self):
|
|||
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 @@ def test_encode_preserves_leading_ws_on_value(self):
|
|||
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
|
||||
|
|
|
@ -0,0 +1,2 @@
|
|||
Allow whitespace only header encoding in ``email.header`` - by Batuhan
|
||||
Taskaya
|
Loading…
Reference in a new issue