mirror of
https://github.com/aptly-dev/aptly.git
synced 2026-04-21 19:48:12 +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:
@@ -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