[issue1403349] in email can't get attachments' filenames using get_filename

Ich Neumon report at bugs.python.org
Thu Aug 26 16:01:23 CEST 2010


Ich Neumon <ichneumonad at gmail.com> added the comment:

A slight update for my workaround for the above with the following code:

if not filename:
   ct = part.get("Content-Type")
   if ct:
      m = re.compile('name=\"?(\S+)\"?').search(ct, 1)
      if m: filename = m.group(1)

I've added ? operators to the double-quotes, and changed the case in the part.get. However, there may be good reasons as to why part.get needs to be case-sensitive. Not my area of expertise though.

----------

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue1403349>
_______________________________________


More information about the Python-bugs-list mailing list