From 0ff2f072b811cd717261b26a28a6875a78a1e90e Mon Sep 17 00:00:00 2001 From: Brad Rydzewski Date: Mon, 7 Dec 2015 12:36:47 -0800 Subject: [PATCH] Update repo.go --- controller/repo.go | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/controller/repo.go b/controller/repo.go index ce72889d7..ba566a91d 100644 --- a/controller/repo.go +++ b/controller/repo.go @@ -173,7 +173,11 @@ func PostRepoKey(c *gin.Context) { c.String(404, "Error fetching repository key") return } - body, _ := ioutil.ReadAll(c.Request.Body) + body, err := ioutil.ReadAll(c.Request.Body) + if err != nil { + c.String(500, "Error reading private key from body. %s", err) + return + } pkey := crypto.UnmarshalPrivateKey(body) if pkey == nil { c.String(500, "Cannot unmarshal private key. Invalid format.") @@ -188,6 +192,7 @@ func PostRepoKey(c *gin.Context) { c.String(500, "Error updating repository key") return } + c.String(201, keys.Public) } func DeleteRepo(c *gin.Context) {