File tree Expand file tree Collapse file tree 3 files changed +6
-1
lines changed Expand file tree Collapse file tree 3 files changed +6
-1
lines changed Original file line number Diff line number Diff line change @@ -431,7 +431,7 @@ def newline(self):
431431 if end_of_line != (' ' , '' ):
432432 self ._current_line .push (* end_of_line )
433433 if len (self ._current_line ) > 0 :
434- if self ._current_line .is_onlyws ():
434+ if self ._current_line .is_onlyws () and self . _lines :
435435 self ._lines [- 1 ] += str (self ._current_line )
436436 else :
437437 self ._lines .append (str (self ._current_line ))
Original file line number Diff line number Diff line change @@ -4964,6 +4964,9 @@ def test_encode_preserves_leading_ws_on_value(self):
49644964 msg ['SomeHeader' ] = ' value with leading ws'
49654965 self .assertEqual (str (msg ), "SomeHeader: value with leading ws\n \n " )
49664966
4967+ def test_whitespace_header (self ):
4968+ self .assertEqual (Header (' ' ).encode (), ' ' )
4969+
49674970
49684971
49694972# Test RFC 2231 header parameters (en/de)coding
Original file line number Diff line number Diff line change 1+ Allow whitespace only header encoding in ``email.header `` - by Batuhan
2+ Taskaya
You can’t perform that action at this time.
0 commit comments