diff options
author | Robin Jarry <robin@jarry.cc> | 2023-02-23 22:17:36 +0100 |
---|---|---|
committer | Robin Jarry <robin@jarry.cc> | 2023-02-24 18:32:19 +0100 |
commit | bba7159756908f092655bdf6db091daf9eb74f76 (patch) | |
tree | 4806e5e830397d8543f3a4a540a46308c68e11d6 /widgets/compose.go | |
parent | d15b533d4c9eb860b70496d7f44b661d2ab84977 (diff) | |
download | aerc-bba7159756908f092655bdf6db091daf9eb74f76.tar.gz |
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 <ben@bencohen.net>
Signed-off-by: Robin Jarry <robin@jarry.cc>
Tested-by: Ben Cohen <ben@bencohen.net>
Diffstat (limited to 'widgets/compose.go')
-rw-r--r-- | widgets/compose.go | 4 |
1 files changed, 4 insertions, 0 deletions
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)) } |