You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ponymail.apache.org by se...@apache.org on 2021/10/07 21:48:18 UTC

[incubator-ponymail-foal] branch master updated: Strip trailing \r\n from list-id value

This is an automated email from the ASF dual-hosted git repository.

sebb pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-ponymail-foal.git


The following commit(s) were added to refs/heads/master by this push:
     new 94e3efc  Strip trailing \r\n from list-id value
94e3efc is described below

commit 94e3efc9f27cb6d1bee3bbbfb74961bf7d7da7bd
Author: Sebb <se...@apache.org>
AuthorDate: Thu Oct 7 22:48:05 2021 +0100

    Strip trailing \r\n from list-id value
    
    This relates to #113.
    Tests are still needed
---
 tools/plugins/dkim_id.py | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/tools/plugins/dkim_id.py b/tools/plugins/dkim_id.py
index 0fdc410..27c6e79 100644
--- a/tools/plugins/dkim_id.py
+++ b/tools/plugins/dkim_id.py
@@ -321,12 +321,12 @@ def rfc6376_reformed_canon(
     # print(headers, body)
     k: bytes
     v: bytes
-    # If any List-Id header is set to the LID, lid is empty
+    # If any List-Id header is set to the LID, lid is not needed in the hash
     for (k, v) in headers:
-        if k == b"list-id":
-            if v == lid:
-                lid = None
-                break
+        # N.B. headers still contain trailing \r\n
+        if k == b"list-id" and v.rstrip() == lid:
+            lid = None
+            break
     # Construct hashable bytes from the parsed message
     return (lid or b"", rfc6376_join(headers, body))