mirror of
https://github.com/python/cpython.git
synced 2025-08-04 08:59:19 +00:00
#16811: Fix folding of headers with no value in provisional policies.
This commit is contained in:
parent
36b365ccff
commit
844b0e6971
2 changed files with 46 additions and 1 deletions
|
@ -173,7 +173,7 @@ class EmailPolicy(Policy):
|
|||
lines = value.splitlines()
|
||||
refold = (self.refold_source == 'all' or
|
||||
self.refold_source == 'long' and
|
||||
(len(lines[0])+len(name)+2 > maxlen or
|
||||
(lines and len(lines[0])+len(name)+2 > maxlen or
|
||||
any(len(x) > maxlen for x in lines[1:])))
|
||||
if refold or refold_binary and _has_surrogates(value):
|
||||
return self.header_factory(name, ''.join(lines)).fold(policy=self)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue