[ python-Bugs-1060941 ] email.Parser does not recognize attachment

SourceForge.net noreply at sourceforge.net
Sat Nov 6 01:04:27 CET 2004


Bugs item #1060941, was opened at 2004-11-05 08:30
Message generated for change (Comment added) made by bwarsaw
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1060941&group_id=5470

Category: Python Library
Group: Python 2.3
>Status: Closed
>Resolution: Fixed
Priority: 5
Submitted By: Martin Muenstermann (mamuema)
>Assigned to: Barry A. Warsaw (bwarsaw)
Summary: email.Parser does not recognize attachment

Initial Comment:
Python Version: 2.3.4
I received an email with attachment, whose sender chose
a boundary starting with a whitespace (' '). 
Problem: email.Parser does not recognize the
attachment, msg.is_multipart() returns False,
msg.walk() returns the whole mail as one part.

The problem seems to be caused by the fact that the
implementation of msg.get_boundary() calls strip().

Problem can be reproduced with the attached script.
Output for me is:
msg.get_content_maintype(): multipart
msg.is_multipart():         False
msg.get_boundary():         'simple boundary'
msg.get_param('boundary'):  ' simple boundary'

I don't know if this boundary is legal according to the
RFCs, but maybe we should handle it anyway?

Regards,
 Martin


----------------------------------------------------------------------

>Comment By: Barry A. Warsaw (bwarsaw)
Date: 2004-11-05 19:04

Message:
Logged In: YES 
user_id=12800

RFC 2046 does not allow boundaries to end with whitespace,
but it does allow them to begin with whitespace.  You're
right that the bug is in get_boundary() -- that should
rstrip the value.  I don't think we should support
boundaries that end in whitespace, but I will fix this for
Python 2.3 and 2.4.

----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1060941&group_id=5470


More information about the Python-bugs-list mailing list