summaryrefslogtreecommitdiffstats
path: root/models/release.go
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 /models/release.go
parent69dae1ec1c5265e815c8b0fedff3399438e2e380 (diff)
downloadgitea-c912494609470f10401594391c6f2763684cb624.tar.gz
gitea-c912494609470f10401594391c6f2763684cb624.zip
#3076 detect invalid tag name git error
Diffstat (limited to 'models/release.go')
-rw-r--r--models/release.go5
1 files changed, 4 insertions, 1 deletions
diff --git a/models/release.go b/models/release.go
index 026ab8ff5c..2355ef3092 100644
--- a/models/release.go
+++ b/models/release.go
@@ -67,9 +67,12 @@ func createTag(gitRepo *git.Repository, rel *Release) error {
return fmt.Errorf("GetBranchCommit: %v", err)
}
- // Trim '--' prefix to prevent command line argument vulnerability
+ // Trim '--' prefix to prevent command line argument vulnerability.
rel.TagName = strings.TrimPrefix(rel.TagName, "--")
if err = gitRepo.CreateTag(rel.TagName, commit.ID.String()); err != nil {
+ if strings.Contains(err.Error(), "is not a valid tag name") {
+ return ErrInvalidTagName{rel.TagName}
+ }
return err
}
} else {