[New-bugs-announce] [issue35863] email.headers wraps headers badly

Jon Ribbens report at bugs.python.org
Wed Jan 30 16:23:57 EST 2019


New submission from Jon Ribbens <jribbens at gmail.com>:

email.headers can wrap headers by putting a FWS as the very first thing in the output:

>>> from email.header import Header
>>> Header("a" * 67, header_name="Content-ID").encode() 
'\n aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa'

i.e. it produces headers that look like this:

    Content-ID:
        blah

It is unclear to me whether this is compliant with the spec, but there seems to be little reason to do this, and good reason not to in that at the very least Outlook does not understand such headers. (e.g. if you have an HTML email with an inline image referenced by Content-ID then Outlook will not find it if the Content-ID header is wrapped as above.)

----------
components: Library (Lib)
messages: 334594
nosy: jribbens
priority: normal
severity: normal
status: open
title: email.headers wraps headers badly
versions: Python 3.4, Python 3.5, Python 3.6, Python 3.7

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue35863>
_______________________________________


More information about the New-bugs-announce mailing list