Author chrisb@emergence.com
Recipients chrisb@emergence.com
Date 2017-05-31.22:08:52
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1496268533.13.0.885025594185.issue30532@psf.upfronthosting.co.za>
In-reply-to
Content
When email.policy.SMTP.fold() attempts to wrap a line in which a chunk that does not contain a space is longer than the maximum line length, two things go wrong:
 - The second line does not begin with a space, creating an invalid header.
 - The space before the long chunk is stripped, causing the line break to occur in an invalid place.

In the attached test case, email.policy.SMTP.fold() is called on a line of the style:
Content-Disposition: attachment; filename="<filename>"

<filename> does not contain any spaces and increases in length with each pass. Everything works correctly when 'filename="<filename>"' fits onto one line. However, once it is longer than the maximum line length, the following happens:
 - the space after the semicolon is dropped
 - the line break often splits up the 'filename' keyword
 - the second line loses the initial whitespace
History
Date User Action Args
2017-05-31 22:08:53chrisb@emergence.comsetrecipients: + chrisb@emergence.com
2017-05-31 22:08:53chrisb@emergence.comsetmessageid: <1496268533.13.0.885025594185.issue30532@psf.upfronthosting.co.za>
2017-05-31 22:08:53chrisb@emergence.comlinkissue30532 messages
2017-05-31 22:08:52chrisb@emergence.comcreate