mirror of
https://github.com/go-gitea/gitea
synced 2025-08-24 18:38:28 +00:00
fix #19970 by the way, fix some error response about protected tags. Signed-off-by: a1012112796 <1012112796@qq.com>
This commit is contained in:
@@ -344,6 +344,8 @@ func DeleteRelease(ctx *context.APIContext) {
|
||||
// "$ref": "#/responses/empty"
|
||||
// "404":
|
||||
// "$ref": "#/responses/notFound"
|
||||
// "405":
|
||||
// "$ref": "#/responses/empty"
|
||||
|
||||
id := ctx.ParamsInt64(":id")
|
||||
rel, err := models.GetReleaseByID(id)
|
||||
@@ -357,6 +359,10 @@ func DeleteRelease(ctx *context.APIContext) {
|
||||
return
|
||||
}
|
||||
if err := releaseservice.DeleteReleaseByID(id, ctx.User, false); err != nil {
|
||||
if models.IsErrProtectedTagName(err) {
|
||||
ctx.Error(http.StatusMethodNotAllowed, "delTag", "user not allowed to delete protected tag")
|
||||
return
|
||||
}
|
||||
ctx.Error(http.StatusInternalServerError, "DeleteReleaseByID", err)
|
||||
return
|
||||
}
|
||||
|
Reference in New Issue
Block a user