summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKoni Marti <koni.marti@gmail.com>2022-07-07 17:43:29 +0200
committerRobin Jarry <robin@jarry.cc>2022-07-10 20:40:39 +0200
commitaae46c7afdf4f64a49384afde41984edf936da76 (patch)
treed2c7c412b4e42a3de6893721d5bef9731fc8be92
parent635530b12d46ff29555ba322a6bfd3c5bf8f4e7a (diff)
downloadaerc-aae46c7afdf4f64a49384afde41984edf936da76.zip
composer: remove header if empty
Remove a header when it is empty. Commit a253e89bdae6 ("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>
-rw-r--r--widgets/compose.go3
1 files changed, 2 insertions, 1 deletions
diff --git a/widgets/compose.go b/widgets/compose.go
index da2bde3..2516c48 100644
--- a/widgets/compose.go
+++ b/widgets/compose.go
@@ -974,7 +974,8 @@ func (he *headerEditor) storeValue() {
switch strings.ToLower(he.name) {
case "to", "from", "cc", "bcc":
if strings.TrimSpace(val) == "" {
- // Don't set empty address list headers
+ // if header is empty, delete it
+ he.header.Del(he.name)
return
}
list, err := mail.ParseAddressList(val)