From bba7159756908f092655bdf6db091daf9eb74f76 Mon Sep 17 00:00:00 2001 From: Robin Jarry Date: Thu, 23 Feb 2023 22:17:36 +0100 Subject: compose: only add delimiter when a signature is defined Inserting a solitary "-- " delimiter without any signature after it makes no sense. Skip the whole delimiter check if the signature is empty. Trim leading and trailing white space along the way. Fixes: a553b33ebcbd ("compose: ensure signature uses standard delimiter") Reported-by: Ben Cohen Signed-off-by: Robin Jarry Tested-by: Ben Cohen --- widgets/compose.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/widgets/compose.go b/widgets/compose.go index b74e1537..dc4719a6 100644 --- a/widgets/compose.go +++ b/widgets/compose.go @@ -542,6 +542,10 @@ func (c *Composer) AddSignature() { } else { signature = c.readSignatureFromFile() } + signature = bytes.TrimSpace(signature) + if len(signature) == 0 { + return + } signature = ensureSignatureDelimiter(signature) c.AppendContents(bytes.NewReader(signature)) } -- cgit v1.2.3-54-g00ecf