diff --git a/routers/web/repo/release.go b/routers/web/repo/release.go index 8dc78079e2..7adb22667e 100644 --- a/routers/web/repo/release.go +++ b/routers/web/repo/release.go @@ -592,7 +592,17 @@ func DeleteTag(ctx *context.Context) { } func deleteReleaseOrTag(ctx *context.Context, isDelTag bool) { - if err := releaseservice.DeleteReleaseByID(ctx, ctx.FormInt64("id"), ctx.Doer, isDelTag); err != nil { + id := ctx.FormInt64("id") + rel, err := repo_model.GetReleaseByID(ctx, id) + if err != nil { + ctx.ServerError("GetRelease", err) + return + } + if ctx.Repo.Repository.ID != rel.RepoID { + ctx.NotFound("CompareRepoID", repo_model.ErrReleaseNotExist{}) + return + } + if err := releaseservice.DeleteReleaseByID(ctx, id, ctx.Doer, isDelTag); err != nil { if models.IsErrProtectedTagName(err) { ctx.Flash.Error(ctx.Tr("repo.release.tag_name_protected")) } else {