From 894f69b815f811945556ba9332b6e43151e57d46 Mon Sep 17 00:00:00 2001 From: Petr Vorel Date: Wed, 14 Oct 2026 11:45:28 +0200 Subject: [PATCH] API: Properly quote name in email addresss MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit RFC 5322, "Internet Message Format" specifies in ยง3.4 Address Specification that commas separate the addresses in a list. But some people use comma in their name: pwclient list -S "$series_id" -f '%{submitter}' Surname, Name Using passing the output to git send-email causes it to fail (at least dovecot refuses to send): git send-email --to="Surname, Name " ... 5.5.4 Invalid TO: Missing domain Properly quoting with email.utils.formataddr helps: pwclient list -S "$series_id" -f '%{submitter}' "Surname, Name" git send-email --to='"Surname, Name" " ... To: "Surname, Name" Result: 250 Signed-off-by: Petr Vorel --- pwclient/api.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/pwclient/api.py b/pwclient/api.py index de2ab83..b9c21f0 100644 --- a/pwclient/api.py +++ b/pwclient/api.py @@ -6,6 +6,7 @@ import abc import base64 +import email.utils import json import http import re @@ -752,7 +753,9 @@ def _format_person(person): return '' if person['name']: - return f"{person['name']} <{person['email']}>" + return email.utils.formataddr( + (person['name'], person['email']) + ) return person['email'] def _format_user(user):