diff options
-rw-r--r-- | Mailman/Handlers/MimeDel.py | 22 | ||||
-rw-r--r-- | NEWS | 4 |
2 files changed, 25 insertions, 1 deletions
diff --git a/Mailman/Handlers/MimeDel.py b/Mailman/Handlers/MimeDel.py index 89b03644..b55bd5c4 100644 --- a/Mailman/Handlers/MimeDel.py +++ b/Mailman/Handlers/MimeDel.py @@ -1,4 +1,4 @@ -# Copyright (C) 2002-2009 by the Free Software Foundation, Inc. +# Copyright (C) 2002-2011 by the Free Software Foundation, Inc. # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License @@ -96,6 +96,11 @@ def process(mlist, msg, msgdata): if ctype == 'multipart/alternative': firstalt = msg.get_payload(0) reset_payload(msg, firstalt) + # Now that we've collapsed the MPA parts, go through the message + # and recast any multipart parts with only one sub-part as just + # the sub-part. + if msg.is_multipart(): + recast_multipart(msg) # If we removed some parts, make note of this changedp = 0 if numparts <> len([subpart for subpart in msg.walk()]): @@ -194,6 +199,21 @@ def collapse_multipart_alternatives(msg): +def recast_multipart(msg): + # If we're left with a multipart message with only one sub-part, recast + # the message to just the sub-part. + if msg.is_multipart(): + if len(msg.get_payload()) == 1: + reset_payload(msg, msg.get_payload(0)) + # now that we've recast this part, check the subordinate parts + recast_multipart(msg) + else: + # This part's OK but check deeper. + for part in msg.get_payload(): + recast_multipart(part) + + + def to_plaintext(msg): changedp = 0 for subpart in typed_subpart_iterator(msg, 'text', 'html'): @@ -13,6 +13,10 @@ Here is a history of user visible changes to Mailman. Bug Fixes and other patches + - Fixed a bug where content filtering could leave a multipart message or + part with just one sub-part. These should be recast to just the sub-part. + Bug #701558. + - Fixed a bug that could erroneously handle posts from addresses in *_these_nonmembers and send held/rejected notices to bogus addresses when The From or other sender header is RFC 2047 encoded. Bug #702516. |