From aae46c7afdf4f64a49384afde41984edf936da76 Mon Sep 17 00:00:00 2001 From: Koni Marti Date: Thu, 7 Jul 2022 17:43:29 +0200 Subject: 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 Acked-by: Tim Culverhouse --- widgets/compose.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) 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) -- cgit v1.2.3