Hi,


I hope this hits the right people (looking at some archives it seems to be, 
despite the list being mainly for MM3). Apologies if you consider it just noise.



I have a patch for Mailman 2.1.23 for MIME munging when there are no headers or 
footers. There is code to prevent this from happening but it wasn't happening 
for us.

The problem we saw occurred when a meeting request was created in Outlook and a 
mailing list was added as an invited recipient. Mailman would place MIME 
sections in a multipart which Outlook didn't recognice as a meeting request.



This patch simply allows whitespace-only headers and footers to be considered 
'empty' so that the MIME structure is not altered in such cases. I suspect just 
testing for a single newline character would be enough, but I like to wear a 
belt and braces.



Iain


--- ../../../mailman-2.1.23/Mailman/Handlers/Decorate.py	2017-03-15 14:30:56.493553128 +0000
+++ Mailman--Handlers--Decorate.py	2017-03-15 15:41:08.028048195 +0000
@@ -15,7 +15,9 @@
 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
 # USA.
 
-"""Decorate a message by sticking the header and footer around it."""
+"""Decorate a message by sticking the header and footer around it.
+
+MIME layout is altered if header or footer is specified."""
 
 import re
 
@@ -210,7 +212,12 @@
 
 def decorate(mlist, template, what, extradict=None):
     # `what' is just a descriptive phrase used in the log message
-    #
+
+    # IF: Check for header or footer being empty or consisting of only whitespace
+    # and return an empty string
+    if (re.match(r'\s*$', template)):
+        return ""
+
     # BAW: We've found too many situations where Python can be fooled into
     # interpolating too much revealing data into a format string.  For
     # example, a footer of "% silly %(real_name)s" would give a header
_______________________________________________
Mailman-Developers mailing list
Mailman-Developers@python.org
https://mail.python.org/mailman/listinfo/mailman-developers
Mailman FAQ: http://wiki.list.org/x/AgA3
Searchable Archives: 
http://www.mail-archive.com/mailman-developers%40python.org/
Unsubscribe: 
https://mail.python.org/mailman/options/mailman-developers/archive%40jab.org

Security Policy: http://wiki.list.org/x/QIA9

Reply via email to