diff options
-rw-r--r-- | Lib/email/Header.py | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/Lib/email/Header.py b/Lib/email/Header.py index 47a5508..83fe0d5 100644 --- a/Lib/email/Header.py +++ b/Lib/email/Header.py @@ -456,7 +456,14 @@ def _split_ascii(s, firstlen, restlen, continuation_ws, splitchars): elif curlen + partlen > maxlen: if this: lines.append(joiner.join(this) + eol) - this = [part] + # If this part is longer than maxlen and we aren't already + # splitting on whitespace, try to recursively split this line + # on whitespace. + if partlen > maxlen and ch <> ' ': + this = [_split_ascii(part, maxlen, restlen, + continuation_ws, ' ')] + else: + this = [part] linelen = wslen + partlen maxlen = restlen else: |