aboutsummaryrefslogtreecommitdiffstats
path: root/Mailman
diff options
context:
space:
mode:
authorMark Sapiro <mark@msapiro.net>2017-05-12 12:17:13 -0700
committerMark Sapiro <mark@msapiro.net>2017-05-12 12:17:13 -0700
commitfb58b853207250551741f2e27640194157d52210 (patch)
treea5acfaf45fa745880067197f24cc651a1f286040 /Mailman
parente9f1529fbf56034013a680c60062d632ce5f4cd5 (diff)
downloadmailman2-fb58b853207250551741f2e27640194157d52210.tar.gz
mailman2-fb58b853207250551741f2e27640194157d52210.tar.xz
mailman2-fb58b853207250551741f2e27640194157d52210.zip
Improvements in subject prefixing with encoded prefixes.
Diffstat (limited to 'Mailman')
-rwxr-xr-xMailman/Handlers/CookHeaders.py14
1 files changed, 8 insertions, 6 deletions
diff --git a/Mailman/Handlers/CookHeaders.py b/Mailman/Handlers/CookHeaders.py
index 84d3032d..3e2806f0 100755
--- a/Mailman/Handlers/CookHeaders.py
+++ b/Mailman/Handlers/CookHeaders.py
@@ -1,4 +1,4 @@
-# Copyright (C) 1998-2016 by the Free Software Foundation, Inc.
+# Copyright (C) 1998-2017 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
@@ -423,9 +423,11 @@ def prefix_subject(mlist, msg, msgdata):
recolon = 'Re:'
else:
recolon = ''
+ # Strip leading and trailing whitespace from subject.
+ subject = subject.strip()
# At this point, subject may become null if someone post mail with
- # subject: [subject prefix]
- if subject.strip() == '':
+ # Subject: [subject prefix]
+ if subject == '':
# We want the i18n context to be the list's preferred_language. It
# could be the poster's.
otrans = i18n.get_translation()
@@ -462,10 +464,10 @@ def prefix_subject(mlist, msg, msgdata):
pass
# Get the header as a Header instance, with proper unicode conversion
# Because of rfc2047 encoding, spaces between encoded words can be
- # insignificant, so we need to append a space to prefix but only when
- # we have Re:.
+ # insignificant, so we need to append spaces to our encoded stuff.
+ prefix += ' '
if recolon:
- prefix += ' '
+ recolon += ' '
if old_style:
h = uheader(mlist, recolon, 'Subject', continuation_ws=ws)
h.append(prefix)