From 5e3460ae627e5a07f6c17c2d01ab9850ee617ee3 Mon Sep 17 00:00:00 2001 From: Ales Bregar Date: Mon, 11 Aug 2025 15:08:11 +0200 Subject: [PATCH] system test t12_api sends empty keyRef string, making gpg fail --- pgp/gnupg.go | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/pgp/gnupg.go b/pgp/gnupg.go index dbff8ddc..bab2db21 100644 --- a/pgp/gnupg.go +++ b/pgp/gnupg.go @@ -35,11 +35,14 @@ func (g *GpgSigner) SetBatch(batch bool) { // SetKey sets key ID to use when signing files func (g *GpgSigner) SetKey(keyRef string) { - if g.keyRefs == nil { - g.keyRefs = []string{strings.TrimSpace(keyRef)} - } else { - g.keyRefs = append(g.keyRefs, strings.TrimSpace(keyRef)) - } + keyRef = strings.TrimSpace(keyRef) + if keyRef != "" { + if g.keyRefs == nil { + g.keyRefs = []string{keyRef} + } else { + g.keyRefs = append(g.keyRefs, keyRef) + } + } } // SetKeyRing allows to set custom keyring and secretkeyring