diff options
author | Lauris BH <lauris@nix.lv> | 2017-10-15 22:59:24 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-10-15 22:59:24 +0300 |
commit | f3833b7ce4dc78095194808c6e07d8ae133e7ab5 (patch) | |
tree | cdcb53731d4523f068a6e532bf5da9e2759f8cb2 /modules/validation | |
parent | c25303b11c323045718a5af373c11f5807f77fb7 (diff) | |
download | gitea-f3833b7ce4dc78095194808c6e07d8ae133e7ab5.tar.gz gitea-f3833b7ce4dc78095194808c6e07d8ae133e7ab5.zip |
Create new branch from branch selection dropdown (#2130)
* Create new branch from branch selection dropdown and rewrite it to VueJS
* Make updateLocalCopyToCommit as not exported
* Move branch name validation to model
* Fix possible race condition
Diffstat (limited to 'modules/validation')
-rw-r--r-- | modules/validation/binding.go | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/modules/validation/binding.go b/modules/validation/binding.go index 783499e69a..3f671890b6 100644 --- a/modules/validation/binding.go +++ b/modules/validation/binding.go @@ -44,12 +44,18 @@ func addGitRefNameBindingRule() { } // Additional rules as described at https://www.kernel.org/pub/software/scm/git/docs/git-check-ref-format.html if strings.HasPrefix(str, "/") || strings.HasSuffix(str, "/") || - strings.HasPrefix(str, ".") || strings.HasSuffix(str, ".") || - strings.HasSuffix(str, ".lock") || - strings.Contains(str, "..") || strings.Contains(str, "//") { + strings.HasSuffix(str, ".") || strings.Contains(str, "..") || + strings.Contains(str, "//") { errs.Add([]string{name}, ErrGitRefName, "GitRefName") return false, errs } + parts := strings.Split(str, "/") + for _, part := range parts { + if strings.HasSuffix(part, ".lock") || strings.HasPrefix(part, ".") { + errs.Add([]string{name}, ErrGitRefName, "GitRefName") + return false, errs + } + } return true, errs }, |