mirror of
https://github.com/aptly-dev/aptly.git
synced 2026-01-11 03:11:50 +00:00
Merge pull request #1493 from Daedaluz/fix/update-repo-api
Editing repo via api 404
This commit is contained in:
1
AUTHORS
1
AUTHORS
@@ -72,3 +72,4 @@ List of contributors, in chronological order:
|
|||||||
* Itay Porezky (https://github.com/itayporezky)
|
* Itay Porezky (https://github.com/itayporezky)
|
||||||
* JupiterRider (https://github.com/JupiterRider)
|
* JupiterRider (https://github.com/JupiterRider)
|
||||||
* Agustin Henze (https://github.com/agustinhenze)
|
* Agustin Henze (https://github.com/agustinhenze)
|
||||||
|
* Tobias Assarsson (https://github.com/daedaluz)
|
||||||
|
|||||||
@@ -195,17 +195,18 @@ func apiReposEdit(c *gin.Context) {
|
|||||||
collectionFactory := context.NewCollectionFactory()
|
collectionFactory := context.NewCollectionFactory()
|
||||||
collection := collectionFactory.LocalRepoCollection()
|
collection := collectionFactory.LocalRepoCollection()
|
||||||
|
|
||||||
repo, err := collection.ByName(c.Params.ByName("name"))
|
name := c.Params.ByName("name")
|
||||||
|
repo, err := collection.ByName(name)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
AbortWithJSONError(c, 404, err)
|
AbortWithJSONError(c, 404, err)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
if b.Name != nil {
|
if b.Name != nil && *b.Name != name {
|
||||||
_, err := collection.ByName(*b.Name)
|
_, err := collection.ByName(*b.Name)
|
||||||
if err == nil {
|
if err == nil {
|
||||||
// already exists
|
// already exists
|
||||||
AbortWithJSONError(c, 404, err)
|
AbortWithJSONError(c, 404, fmt.Errorf("local repo with name %q already exists", *b.Name))
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
repo.Name = *b.Name
|
repo.Name = *b.Name
|
||||||
|
|||||||
Reference in New Issue
Block a user