From 7651d375b035cdfde969aaa4556b13f3caab8781 Mon Sep 17 00:00:00 2001 From: Mark Sapiro Date: Sun, 14 Feb 2021 19:36:36 -0800 Subject: Fix missing Subject: in some Wrap Message wrappers. --- Mailman/Handlers/WrapMessage.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'Mailman') diff --git a/Mailman/Handlers/WrapMessage.py b/Mailman/Handlers/WrapMessage.py index 0ee08cb1..3aef64a2 100644 --- a/Mailman/Handlers/WrapMessage.py +++ b/Mailman/Handlers/WrapMessage.py @@ -63,13 +63,19 @@ def process(mlist, msg, msgdata): # make a copy of the msg, then delete almost everything and set/copy # what we want. omsg = copy.deepcopy(msg) + # If CookHeaders didn't change the Subject: we need to keep it too. + # Get a fresh list. + keepers = list(KEEPERS) + if 'subject' not in [key.lower() for key in + msgdata.get('add_header', {}).keys()]: + keepers.append('subject') for key in msg.keys(): - if key.lower() not in KEEPERS: + if key.lower() not in keepers: del msg[key] msg['MIME-Version'] = '1.0' msg['Message-ID'] = Utils.unique_message_id(mlist) # Add the headers from CookHeaders. - for k, v in msgdata['add_header'].items(): + for k, v in msgdata.get('add_header', {}).items(): msg[k] = v # Are we including dmarc_wrapped_message_text? I.e., do we have text and # are we wrapping because of dmarc_moderation_action? -- cgit v1.2.3