diff --git a/api/repos.go b/api/repos.go index 6d4f4a8a..94740e1b 100644 --- a/api/repos.go +++ b/api/repos.go @@ -60,9 +60,9 @@ func apiReposCreate(c *gin.Context) { // PUT /api/repos/:name func apiReposEdit(c *gin.Context) { var b struct { - Comment string - DefaultDistribution string - DefaultComponent string + Comment *string + DefaultDistribution *string + DefaultComponent *string } if !c.Bind(&b) { @@ -79,14 +79,14 @@ func apiReposEdit(c *gin.Context) { return } - if b.Comment != "" { - repo.Comment = b.Comment + if b.Comment != nil { + repo.Comment = *b.Comment } - if b.DefaultDistribution != "" { - repo.DefaultDistribution = b.DefaultDistribution + if b.DefaultDistribution != nil { + repo.DefaultDistribution = *b.DefaultDistribution } - if b.DefaultComponent != "" { - repo.DefaultComponent = b.DefaultComponent + if b.DefaultComponent != nil { + repo.DefaultComponent = *b.DefaultComponent } err = collection.Update(repo)