compose: prevent sending empty address list headers

Aerc was sending empty address list header fields (specifically CC by
default). This was causing DKIM failures in lists.sr.ht. RFC 5322 states
that an address field should consist of the field name and one or more
addresses, implying empty fields are not allowed.

Signed-off-by: Tim Culverhouse <tim@timculverhouse.com>
Acked-by: Robin Jarry <robin@jarry.cc>
This commit is contained in:
Tim Culverhouse 2022-05-25 14:24:05 -05:00 committed by Robin Jarry
parent 57bd9e318b
commit a253e89bda
1 changed files with 4 additions and 0 deletions

View File

@ -952,6 +952,10 @@ func (he *headerEditor) storeValue() {
val := he.input.String()
switch strings.ToLower(he.name) {
case "to", "from", "cc", "bcc":
if strings.TrimSpace(val) == "" {
// Don't set empty address list headers
return
}
list, err := mail.ParseAddressList(val)
if err == nil {
he.header.SetAddressList(he.name, list)