Mark Sapiro pushed to branch master at GNU Mailman / Mailman Core


Commits:
fd94177e by Mark Sapiro at 2022-07-27T21:09:39+00:00
Don't drop subsequent parts of folded subjects when prefixing.

Fixes #1021

- - - - -
1443e1ed by Mark Sapiro at 2022-07-27T21:09:39+00:00
Merge branch 'prefix' into 'master'

Don't drop subsequent parts of folded subjects when prefixing.

Closes #1021

See merge request mailman/mailman!1025
- - - - -


3 changed files:

- src/mailman/docs/NEWS.rst
- src/mailman/handlers/subject_prefix.py
- src/mailman/handlers/tests/test_subject_prefix.py


Changes:

=====================================
src/mailman/docs/NEWS.rst
=====================================
@@ -65,6 +65,8 @@ Bugs fixed
   alias_domains.  (Closes #1001 and #1013)
 * Updated outgoing runner's fake DSN to use list addresses rather than
   mail...@example.com in From: and To:.  (Closes #1018)
+* Subject prefixing on lists with non-ascii preferred language no longer drops
+  parts of folded subject headers.  (Closes #1021)
 
 REST
 ====


=====================================
src/mailman/handlers/subject_prefix.py
=====================================
@@ -107,6 +107,8 @@ def all_same_charset(mlist, msgdata, subject, prefix, 
prefix_pattern, ws):
         first_line.insert(0, recolon)
     if prefix:
         first_line.insert(0, prefix)
+    if len(lines) > 1:
+        first_line.extend(lines[1:])
     subject_text = EMPTYSTRING.join(first_line)
     return Header(subject_text, charset=list_charset, continuation_ws=ws)
 


=====================================
src/mailman/handlers/tests/test_subject_prefix.py
=====================================
@@ -270,3 +270,13 @@ class TestSubjectPrefix(unittest.TestCase):
         self.assertEqual(decoded,
                          [(b'[Test] ', 'us-ascii'),
                           (b'\xd6\xd0\xce\xc4', 'eucgb2312_cn')])
+
+    def test_non_ascii_list_folded_subject(self):
+        # Test a folded subject header on a list with non-ascii
+        # preferred_language cset.
+        msg = Message()
+        msg['Subject'] = 'This is a folded subject\n header.'
+        self._mlist.preferred_language.charset = 'utf-8'
+        self._process(self._mlist, msg, {})
+        self.assertEqual(str(msg['subject']),
+                         '[Test] This is a folded subject header.')



View it on GitLab: 
https://gitlab.com/mailman/mailman/-/compare/59a7cfa068fe61fe517f4bbc79c2174f2e9ff2ef...1443e1edab40aba5778a554a4baecf3fd788ca62

-- 
View it on GitLab: 
https://gitlab.com/mailman/mailman/-/compare/59a7cfa068fe61fe517f4bbc79c2174f2e9ff2ef...1443e1edab40aba5778a554a4baecf3fd788ca62
You're receiving this email because of your account on gitlab.com.


_______________________________________________
Mailman-checkins mailing list -- mailman-checkins@python.org
To unsubscribe send an email to mailman-checkins-le...@python.org
https://mail.python.org/mailman3/lists/mailman-checkins.python.org/
Member address: arch...@jab.org

Reply via email to