composer: remove header if empty
Remove a header when it is empty.
Commit a253e89bda
("compose: prevent sending empty address list
headers") tried to avoid sending empty headers; but instead of deleting
the header, the empty string value was just ignored.
Fixes: https://todo.sr.ht/~rjarry/aerc/55
Signed-off-by: Koni Marti <koni.marti@gmail.com>
Acked-by: Tim Culverhouse <tim@timculverhouse.com>
This commit is contained in:
parent
635530b12d
commit
aae46c7afd
1 changed files with 2 additions and 1 deletions
|
@ -974,7 +974,8 @@ func (he *headerEditor) storeValue() {
|
||||||
switch strings.ToLower(he.name) {
|
switch strings.ToLower(he.name) {
|
||||||
case "to", "from", "cc", "bcc":
|
case "to", "from", "cc", "bcc":
|
||||||
if strings.TrimSpace(val) == "" {
|
if strings.TrimSpace(val) == "" {
|
||||||
// Don't set empty address list headers
|
// if header is empty, delete it
|
||||||
|
he.header.Del(he.name)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
list, err := mail.ParseAddressList(val)
|
list, err := mail.ParseAddressList(val)
|
||||||
|
|
Loading…
Reference in a new issue