mirror of
https://github.com/aptly-dev/aptly.git
synced 2026-07-16 12:08:04 +00:00
fix gpg keys
This commit is contained in:
committed by
Lorenzo Bolla
parent
d13de0464e
commit
8e02a03170
+9
-1
@@ -7,6 +7,7 @@ import (
|
|||||||
"path/filepath"
|
"path/filepath"
|
||||||
|
|
||||||
"github.com/gin-gonic/gin"
|
"github.com/gin-gonic/gin"
|
||||||
|
"github.com/aptly-dev/aptly/pgp"
|
||||||
)
|
)
|
||||||
|
|
||||||
// POST /api/gpg
|
// POST /api/gpg
|
||||||
@@ -57,10 +58,17 @@ func apiGPGAddKey(c *gin.Context) {
|
|||||||
args = append(args, "--recv", b.GpgKeyID)
|
args = append(args, "--recv", b.GpgKeyID)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
finder := pgp.GPG1Finder()
|
||||||
|
gpg, _, err := finder.FindGPG()
|
||||||
|
if err != nil {
|
||||||
|
c.AbortWithError(400, err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
// it might happened that we have a situation with an erroneous
|
// it might happened that we have a situation with an erroneous
|
||||||
// gpg command (e.g. when GpgKeyID and GpgKeyArmor is set).
|
// gpg command (e.g. when GpgKeyID and GpgKeyArmor is set).
|
||||||
// there is no error handling for such as gpg will do this for us
|
// there is no error handling for such as gpg will do this for us
|
||||||
cmd := exec.Command("gpg", args...)
|
cmd := exec.Command(gpg, args...)
|
||||||
cmd.Stdout = os.Stdout
|
cmd.Stdout = os.Stdout
|
||||||
if err = cmd.Run(); err != nil {
|
if err = cmd.Run(); err != nil {
|
||||||
c.AbortWithError(400, err)
|
c.AbortWithError(400, err)
|
||||||
|
|||||||
Reference in New Issue
Block a user