mirror of
https://github.com/aptly-dev/aptly.git
synced 2026-04-20 19:38:39 +00:00
Make comment and defaults nullable in repo edit
This commit is contained in:
18
api/repos.go
18
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,9 +79,15 @@ func apiReposEdit(c *gin.Context) {
|
||||
return
|
||||
}
|
||||
|
||||
repo.Comment = b.Comment
|
||||
repo.DefaultDistribution = b.DefaultDistribution
|
||||
repo.DefaultComponent = b.DefaultComponent
|
||||
if b.Comment != nil {
|
||||
repo.Comment = *b.Comment
|
||||
}
|
||||
if b.DefaultDistribution != nil {
|
||||
repo.DefaultDistribution = *b.DefaultDistribution
|
||||
}
|
||||
if b.DefaultComponent != nil {
|
||||
repo.DefaultComponent = *b.DefaultComponent
|
||||
}
|
||||
|
||||
err = collection.Update(repo)
|
||||
if err != nil {
|
||||
|
||||
Reference in New Issue
Block a user