Set maxlen to 71 for subsequent lines since we already have a leading space (LP: #1823006), make doctest demonstrate the problem.
This commit is contained in:
+3
-3
@@ -383,8 +383,8 @@ def fold(header, namelen=0):
|
|||||||
'x'
|
'x'
|
||||||
>>> text(fold(b'xyz'*24))
|
>>> text(fold(b'xyz'*24))
|
||||||
'xyzxyzxyzxyzxyzxyzxyzxyzxyzxyzxyzxyzxyzxyzxyzxyzxyzxyzxyzxyzxyzxyzxyzxyz'
|
'xyzxyzxyzxyzxyzxyzxyzxyzxyzxyzxyzxyzxyzxyzxyzxyzxyzxyzxyzxyzxyzxyzxyzxyz'
|
||||||
>>> len(fold('abxyzxyzxyzxyzxyzxyzxyzxyzxyzxyzxyzxyzxyzxyzxyzxyzxyzxyzxyzxyzxyzxyzxyzxy\\r\\n'))
|
>>> len(fold(b'xyz'*48))
|
||||||
78
|
150
|
||||||
"""
|
"""
|
||||||
# 72 is the max line length we actually want, but the header field name
|
# 72 is the max line length we actually want, but the header field name
|
||||||
# has to fit in the first line too (See Debian Bug #863690).
|
# has to fit in the first line too (See Debian Bug #863690).
|
||||||
@@ -409,7 +409,7 @@ def fold(header, namelen=0):
|
|||||||
j = i + 1
|
j = i + 1
|
||||||
pre += header[:i] + b"\r\n "
|
pre += header[:i] + b"\r\n "
|
||||||
header = header[j:]
|
header = header[j:]
|
||||||
maxleng = 72
|
maxleng = 71
|
||||||
if len(header) > 2:
|
if len(header) > 2:
|
||||||
return pre + header
|
return pre + header
|
||||||
else:
|
else:
|
||||||
|
|||||||
Reference in New Issue
Block a user