From: Barry Warsaw Date: Sat, 6 Nov 2004 00:14:05 +0000 (+0000) Subject: get_boundary(): Fix for SF bug #1060941. RFC 2046 says boundaries may begin X-Git-Tag: v2.3.5c1~76 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=3497155a03f41664f291928096c19b3bc9385e7c;p=thirdparty%2FPython%2Fcpython.git get_boundary(): Fix for SF bug #1060941. RFC 2046 says boundaries may begin -- but not end -- with whitespace. --- diff --git a/Lib/email/Message.py b/Lib/email/Message.py index b5302d79b75c..5b76e850b8dd 100644 --- a/Lib/email/Message.py +++ b/Lib/email/Message.py @@ -747,7 +747,8 @@ class Message: # RFC 2231 encoded, so decode. It better end up as ascii charset = boundary[0] or 'us-ascii' return unicode(boundary[2], charset).encode('us-ascii') - return _unquotevalue(boundary.strip()) + # RFC 2046 says that boundaries may begin but not end in w/s + return _unquotevalue(boundary.rstrip()) def set_boundary(self, boundary): """Set the boundary parameter in Content-Type to 'boundary'.