diff options
author | a1012112796 <1012112796@qq.com> | 2022-06-17 04:03:03 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-06-16 22:03:03 +0200 |
commit | e3e06d13afdd882ca5934fde77217ff9554354c4 (patch) | |
tree | 5f46b0277127af587f1aed139d15b024f9dae74d /routers/web/repo/branch.go | |
parent | 89b0aac37449cf7ccdfa52c6edbe537257228bc1 (diff) | |
download | gitea-e3e06d13afdd882ca5934fde77217ff9554354c4.tar.gz gitea-e3e06d13afdd882ca5934fde77217ff9554354c4.zip |
fix permission check for delete tag (#19985)
fix #19970
by the way, fix some error response about protected tags.
Signed-off-by: a1012112796 <1012112796@qq.com>
Diffstat (limited to 'routers/web/repo/branch.go')
-rw-r--r-- | routers/web/repo/branch.go | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/routers/web/repo/branch.go b/routers/web/repo/branch.go index 4bd2af4e8e..84970a96a1 100644 --- a/routers/web/repo/branch.go +++ b/routers/web/repo/branch.go @@ -373,6 +373,12 @@ func CreateBranch(ctx *context.Context) { err = repo_service.CreateNewBranchFromCommit(ctx, ctx.Doer, ctx.Repo.Repository, ctx.Repo.CommitID, form.NewBranchName) } if err != nil { + if models.IsErrProtectedTagName(err) { + ctx.Flash.Error(ctx.Tr("repo.release.tag_name_protected")) + ctx.Redirect(ctx.Repo.RepoLink + "/src/" + ctx.Repo.BranchNameSubURL()) + return + } + if models.IsErrTagAlreadyExists(err) { e := err.(models.ErrTagAlreadyExists) ctx.Flash.Error(ctx.Tr("repo.branch.tag_collision", e.TagName)) |