diff options
author | Barry Warsaw <barry@python.org> | 2006-01-17 04:49:07 (GMT) |
---|---|---|
committer | Barry Warsaw <barry@python.org> | 2006-01-17 04:49:07 (GMT) |
commit | a0f28efcd1819d7baccd1a212a21ffb1af5558bd (patch) | |
tree | b025f080749070ab78d6ab85e6bc5f47398e46e2 /Lib/email/Message.py | |
parent | 989b69a519b1f4a765310b705b30ab0449153591 (diff) | |
download | cpython-a0f28efcd1819d7baccd1a212a21ffb1af5558bd.zip cpython-a0f28efcd1819d7baccd1a212a21ffb1af5558bd.tar.gz cpython-a0f28efcd1819d7baccd1a212a21ffb1af5558bd.tar.bz2 |
Ported 42075 from release23-maint branch.
SF bug #1403349 solution for email 3.0; some MUAs use the 'file' parameter
name in the Content-Distribution header, so Message.get_filename() should fall
back to using that. Will port to the Python 2.5 trunk.
Also, bump the email package version to 3.0.1 for eventual release. Of
course, add a test case too.
XXX Need to update the documentation.
Diffstat (limited to 'Lib/email/Message.py')
-rw-r--r-- | Lib/email/Message.py | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/Lib/email/Message.py b/Lib/email/Message.py index b466f39..88fd786 100644 --- a/Lib/email/Message.py +++ b/Lib/email/Message.py @@ -1,4 +1,4 @@ -# Copyright (C) 2001-2004 Python Software Foundation +# Copyright (C) 2001-2006 Python Software Foundation # Author: Barry Warsaw # Contact: email-sig@python.org @@ -701,11 +701,15 @@ class Message: """Return the filename associated with the payload if present. The filename is extracted from the Content-Disposition header's - `filename' parameter, and it is unquoted. + `filename' parameter, and it is unquoted. If that header is missing + the `filename' parameter, this method falls back to looking for the + `name' parameter. """ missing = object() filename = self.get_param('filename', missing, 'content-disposition') if filename is missing: + filename = self.get_param('name', missing, 'content-disposition') + if filename is missing: return failobj return Utils.collapse_rfc2231_value(filename).strip() |