mirror of
https://codeberg.org/forgejo/forgejo
synced 2024-11-24 02:36:10 +01:00
fix POST /{username}/{reponame}/{tags,release}/delete
(cherry picked from commit a6d2ad6310f754952998fd73118da9f91c563145)
This commit is contained in:
parent
d7b11f5378
commit
a2b1082dda
|
@ -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 {
|
||||
|
|
Loading…
Reference in a new issue