mirror of
https://github.com/aptly-dev/aptly.git
synced 2026-01-12 03:21:33 +00:00
Fix returncode when deleting a mirror with snapshot
When trying to delete a mirror that has snapshot and not providing the force option, the API should not return a `500 StatusInternalServerError`. A `403 StatusForbidden` is more appropriate when the condition is expected by the server.
This commit is contained in:
1
AUTHORS
1
AUTHORS
@@ -54,3 +54,4 @@ List of contributors, in chronological order:
|
||||
* Boxjan (https://github.com/boxjan)
|
||||
* Mauro Regli (https://github.com/reglim)
|
||||
* Alexander Zubarev (https://github.com/strike)
|
||||
* Nicolas Dostert (https://github.com/acdn-ndostert)
|
||||
|
||||
@@ -157,7 +157,7 @@ func apiMirrorsDrop(c *gin.Context) {
|
||||
snapshots := snapshotCollection.ByRemoteRepoSource(repo)
|
||||
|
||||
if len(snapshots) > 0 {
|
||||
return &task.ProcessReturnValue{Code: http.StatusInternalServerError, Value: nil}, fmt.Errorf("won't delete mirror with snapshots, use 'force=1' to override")
|
||||
return &task.ProcessReturnValue{Code: http.StatusForbidden, Value: nil}, fmt.Errorf("won't delete mirror with snapshots, use 'force=1' to override")
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user