Skip to content

API: Properly quote name - #49

Merged
stephenfin merged 1 commit into
getpatchwork:mainfrom
pevik:properly-quote-name
Oct 15, 2026
Merged

stephenfin merged 1 commit into
getpatchwork:mainfrom
pevik:properly-quote-name

Conversation

@pevik

@pevik pevik commented Oct 14, 2026

Copy link
Copy Markdown
Contributor

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 <foo@example.com>

Using passing the output to git send-email causes it to fail (at least dovecot refuses to send):

git send-email --to="Surname, Name <foo@example.com>" ...
5.5.4 Invalid TO: Missing domain

Quoting name helps:

pwclient list -S "$series_id" -f '%{submitter}'
"Surname, Name" <foo@example.com>

git send-email --to='"Surname, Name" <foo@example.com>" ...
To: "Surname, Name" <foo@example.com>
Result: 250

@stephenfin Or, do you want this formatting to have it's own formatting?

@stephenfin

Copy link
Copy Markdown
Member

Rather than doing this manually, can you use email.utils.formataddr from the stdlib? Also, please run tox -e pep8 before submitting to keep the linter job happy 🙏

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 <foo@example.com>

Using passing the output to git send-email causes it to fail (at least
dovecot refuses to send):

    git send-email --to="Surname, Name <foo@example.com>" ...
    5.5.4 Invalid TO: Missing domain

Properly quoting with email.utils.formataddr helps:

    pwclient list -S "$series_id" -f '%{submitter}'
    "Surname, Name" <foo@example.com>

    git send-email --to='"Surname, Name" <foo@example.com>" ...
    To: "Surname, Name" <foo@example.com>
    Result: 250

Signed-off-by: Petr Vorel <pvorel@suse.cz>
@pevik
pevik force-pushed the properly-quote-name branch from f0f501b to 894f69b Compare October 15, 2026 13:20
@stephenfin
stephenfin merged commit 03bd92e into getpatchwork:main Oct 15, 2026
8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants