From 6be4f5e8d03170d950bd9e06e57e1586fb0949c5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Roth?= Date: Sat, 17 Jun 2023 19:10:34 +0200 Subject: [PATCH] gpg api: allow self signed and use default gpg version --- api/gpg.go | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/api/gpg.go b/api/gpg.go index 7bf5f1f0c..605b6c1db 100644 --- a/api/gpg.go +++ b/api/gpg.go @@ -25,7 +25,7 @@ func apiGPGAddKey(c *gin.Context) { } var err error - args := []string{"--no-default-keyring"} + args := []string{"--no-default-keyring", "--allow-non-selfsigned-uid"} keyring := "trustedkeys.gpg" if len(b.Keyring) > 0 { keyring = b.Keyring @@ -73,11 +73,11 @@ func apiGPGAddKey(c *gin.Context) { // there is no error handling for such as gpg will do this for us cmd := exec.Command(gpg, args...) fmt.Printf("running %s %s\n", gpg, strings.Join(args, " ")) - cmd.Stdout = os.Stdout - if err = cmd.Run(); err != nil { - AbortWithJSONError(c, 400, err) + out, err := cmd.CombinedOutput() + if err != nil { + c.JSON(400, string(out)) return } - c.JSON(200, gin.H{}) + c.JSON(200, string(out)) }