[New-bugs-announce] [issue39040] Wrong filename in when mime header was too long

Manfred Kaiser report at bugs.python.org
Fri Dec 13 11:59:51 EST 2019

New submission from Manfred Kaiser <manfred.kaiser at logfile.at>:

I'm working on a mailfilter in python and used the method "get_filename" of the "EmailMessage" class.

In some cases a wrong filename was returned. The reason was, that the Content-Disposition Header had a line break and the following intention was interpreted as part of the filename.

After fixing this bug, I was able to get the right filename.

I had to change "linesep_splitter" in "email.policy" to match the intention.

Old Value:

linesep_splitter = re.compile(r'\n|\r')

New Value:

linesep_splitter = re.compile(r'\n\s+|\r\s+')

components: email
messages: 358343
nosy: barry, mkaiser, r.david.murray
priority: normal
severity: normal
status: open
title: Wrong filename in when mime header was too long
type: behavior
versions: Python 3.5, Python 3.6, Python 3.7, Python 3.8

Python tracker <report at bugs.python.org>

More information about the New-bugs-announce mailing list