summaryrefslogtreecommitdiffstats
path: root/routers
diff options
context:
space:
mode:
authorUnknwon <u@gogs.io>2016-07-23 15:59:19 +0800
committerUnknwon <u@gogs.io>2016-07-23 15:59:19 +0800
commitc912494609470f10401594391c6f2763684cb624 (patch)
tree1f8c047fbb9ed1ae0f852d8899cb037dfd80a47e /routers
parent69dae1ec1c5265e815c8b0fedff3399438e2e380 (diff)
downloadgitea-c912494609470f10401594391c6f2763684cb624.tar.gz
gitea-c912494609470f10401594391c6f2763684cb624.zip
#3076 detect invalid tag name git error
Diffstat (limited to 'routers')
-rw-r--r--routers/repo/release.go9
1 files changed, 6 insertions, 3 deletions
diff --git a/routers/repo/release.go b/routers/repo/release.go
index 8985cdb8f5..4aeec2b8d7 100644
--- a/routers/repo/release.go
+++ b/routers/repo/release.go
@@ -188,10 +188,13 @@ func NewReleasePost(ctx *context.Context, form auth.NewReleaseForm) {
}
if err = models.CreateRelease(ctx.Repo.GitRepo, rel); err != nil {
- if models.IsErrReleaseAlreadyExist(err) {
- ctx.Data["Err_TagName"] = true
+ ctx.Data["Err_TagName"] = true
+ switch {
+ case models.IsErrReleaseAlreadyExist(err):
ctx.RenderWithErr(ctx.Tr("repo.release.tag_name_already_exist"), RELEASE_NEW, &form)
- } else {
+ case models.IsErrInvalidTagName(err):
+ ctx.RenderWithErr(ctx.Tr("repo.release.tag_name_invalid"), RELEASE_NEW, &form)
+ default:
ctx.Handle(500, "CreateRelease", err)
}
return