mirror of
https://github.com/aptly-dev/aptly.git
synced 2026-05-06 22:18:28 +00:00
Merge pull request #465 from SHyx0rmZ/allow-empty-repo-edits-in-api
Allow comment and defaults to be empty when editing a repo through the API
This commit is contained in:
+9
-9
@@ -60,9 +60,9 @@ func apiReposCreate(c *gin.Context) {
|
|||||||
// PUT /api/repos/:name
|
// PUT /api/repos/:name
|
||||||
func apiReposEdit(c *gin.Context) {
|
func apiReposEdit(c *gin.Context) {
|
||||||
var b struct {
|
var b struct {
|
||||||
Comment string
|
Comment *string
|
||||||
DefaultDistribution string
|
DefaultDistribution *string
|
||||||
DefaultComponent string
|
DefaultComponent *string
|
||||||
}
|
}
|
||||||
|
|
||||||
if !c.Bind(&b) {
|
if !c.Bind(&b) {
|
||||||
@@ -79,14 +79,14 @@ func apiReposEdit(c *gin.Context) {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
if b.Comment != "" {
|
if b.Comment != nil {
|
||||||
repo.Comment = b.Comment
|
repo.Comment = *b.Comment
|
||||||
}
|
}
|
||||||
if b.DefaultDistribution != "" {
|
if b.DefaultDistribution != nil {
|
||||||
repo.DefaultDistribution = b.DefaultDistribution
|
repo.DefaultDistribution = *b.DefaultDistribution
|
||||||
}
|
}
|
||||||
if b.DefaultComponent != "" {
|
if b.DefaultComponent != nil {
|
||||||
repo.DefaultComponent = b.DefaultComponent
|
repo.DefaultComponent = *b.DefaultComponent
|
||||||
}
|
}
|
||||||
|
|
||||||
err = collection.Update(repo)
|
err = collection.Update(repo)
|
||||||
|
|||||||
Reference in New Issue
Block a user