]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
get_boundary(): Fix for SF bug #1060941. RFC 2046 says boundaries may begin
authorBarry Warsaw <barry@python.org>
Sat, 6 Nov 2004 00:14:05 +0000 (00:14 +0000)
committerBarry Warsaw <barry@python.org>
Sat, 6 Nov 2004 00:14:05 +0000 (00:14 +0000)
-- but not end -- with whitespace.

Lib/email/Message.py

index b5302d79b75ccb2a952d01cb4486d02a3f3971df..5b76e850b8dd5e286a67cd4a235985d3e8fc09ab 100644 (file)
@@ -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'.