diff mbox series

Avoid quoting email names in trailers

Message ID 20250408204715.2787726-1-robh@kernel.org (mailing list archive)
State New
Headers show
Series Avoid quoting email names in trailers | expand

Commit Message

Rob Herring (Arm) April 8, 2025, 8:47 p.m. UTC
A somewhat common pattern is adding an employer name to the person's name
in trailers (e.g. John Doe (Acme) <john@kernel.org>). The b4 trailers
command will re-write the trailers with quotes around the name.
email.utils.formataddr() does that as it is necessary for email headers,
but it is not necessary for trailers. As we already have the original
value, just use it.

This effectively reverts commit 832010c4d50b ("trailers: normalize
address after parsing") and all the follow-up commits touching this
code. Maintaining quoting or lack of seems more important and common
than oddball 'mailto:' links.

Cc: Brandon Maier <brandon.maier@gmail.com>
Signed-off-by: Rob Herring (Arm) <robh@kernel.org>
---
 src/b4/__init__.py | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)
diff mbox series

Patch

diff --git a/src/b4/__init__.py b/src/b4/__init__.py
index 99ece6484d8e..de324d0f714b 100644
--- a/src/b4/__init__.py
+++ b/src/b4/__init__.py
@@ -1062,10 +1062,7 @@  class LoreTrailer:
             elif re.search(r'\S+@\S+\.\S+', value):
                 self.type = 'person'
                 self.addr = email.utils.parseaddr(value)
-                # Normalize the value with parsed data
-                if self.addr[0] or self.addr[1]:
-                    self.value = email.utils.formataddr(self.addr)
-                else:
+                if not (self.addr[0] or self.addr[1]):
                     self.type = 'unknown'
             else:
                 self.type = 'unknown'