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


Commits:
3e6d5d1b by Mark Sapiro at 2023-03-10T01:09:50+00:00
Don't add Archived-At header to digests.

Fixes #1069

* Don't add Archived-At header to digests.

- - - - -
417e9e15 by Mark Sapiro at 2023-03-10T01:09:51+00:00
Merge branch 'digest' into 'master'

Don't add Archived-At header to digests.

Closes #1069

See merge request mailman/mailman!1107

Merged-by: Mark Sapiro <m...@msapiro.net>

Reviewed-by: 
- - - - -


3 changed files:

- src/mailman/docs/NEWS.rst
- src/mailman/handlers/rfc_2369.py
- src/mailman/handlers/tests/test_rfc_2369.py


Changes:

=====================================
src/mailman/docs/NEWS.rst
=====================================
@@ -38,6 +38,7 @@ Bugs fixed
   log entry.  (Closes #1059)
 * The task runner now evicts old, processed bounce events.  (Closes #1067)
 * We now require authheaders>=0.15.2.  (Closes #1064)
+* Digests no longer contain a bogus Archived-At header.  (Closes #1069)
 
 .. _news-3.3.8:
 


=====================================
src/mailman/handlers/rfc_2369.py
=====================================
@@ -92,14 +92,17 @@ def process(mlist, msg, msgdata):
                 if archiver_url is not None:
                     headers.append(('List-Archive',
                                     '<{}>'.format(archiver_url)))
-                try:
-                    permalink = archiver.system_archiver.permalink(mlist, msg)
-                except Exception:
-                    log.exception('Exception in "{}" archiver'.format(
-                        archiver.system_archiver.name))
-                    permalink = None
-                if permalink is not None:
-                    headers.append(('Archived-At', '<{}>'.format(permalink)))
+                if not msgdata.get('isdigest'):
+                    try:
+                        permalink = archiver.system_archiver.permalink(mlist,
+                                                                       msg)
+                    except Exception:
+                        log.exception('Exception in "{}" archiver'.format(
+                            archiver.system_archiver.name))
+                        permalink = None
+                    if permalink is not None:
+                        headers.append((
+                            'Archived-At', '<{}>'.format(permalink)))
     # XXX RFC 2369 also defines a List-Owner header which we are not currently
     # supporting, but should.
     #


=====================================
src/mailman/handlers/tests/test_rfc_2369.py
=====================================
@@ -112,6 +112,19 @@ Dummy text
             self._msg.get_all('Archived-At'),
             ['<http://example.com/4CMWUN6BHVCMHMDAOSJZ2Q72G5M32MWB>'])
 
+    def test_digest_add_headers(self):
+        # Test the addition of the Archived-At and List-Archive headers.
+        config.push('archiver', """
+        [archiver.dummy]
+        class: {}.DummyArchiver
+        enable: yes
+        """.format(DummyArchiver.__module__))
+        self.addCleanup(config.pop, 'archiver')
+        rfc_2369.process(self._mlist, self._msg, dict(isdigest=True))
+        self.assertEqual(
+            self._msg.get_all('List-Archive'), ['<http://example.com>'])
+        self.assertIsNone(self._msg.get('Archived-At'))
+
     def test_prototype_no_url(self):
         # The prototype archiver is not web-based, it must not return URLs
         config.push('archiver', """



View it on GitLab: 
https://gitlab.com/mailman/mailman/-/compare/65b397d10780b4f99fcbd923fc0d23b02e368abe...417e9e1524358b702021d11ca74ae8f87a5c352c

-- 
View it on GitLab: 
https://gitlab.com/mailman/mailman/-/compare/65b397d10780b4f99fcbd923fc0d23b02e368abe...417e9e1524358b702021d11ca74ae8f87a5c352c
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