diff options
Diffstat (limited to 'modules/validation')
-rw-r--r-- | modules/validation/binding.go | 11 |
1 files changed, 4 insertions, 7 deletions
diff --git a/modules/validation/binding.go b/modules/validation/binding.go index 5d5c64611f..7baa36ccc5 100644 --- a/modules/validation/binding.go +++ b/modules/validation/binding.go @@ -24,16 +24,13 @@ const ( ErrRegexPattern = "RegexPattern" ) -var ( - // GitRefNamePatternInvalid is regular expression with unallowed characters in git reference name - // They cannot have ASCII control characters (i.e. bytes whose values are lower than \040, or \177 DEL), space, tilde ~, caret ^, or colon : anywhere. - // They cannot have question-mark ?, asterisk *, or open bracket [ anywhere - GitRefNamePatternInvalid = regexp.MustCompile(`[\000-\037\177 \\~^:?*[]+`) -) +// GitRefNamePatternInvalid is regular expression with unallowed characters in git reference name +// They cannot have ASCII control characters (i.e. bytes whose values are lower than \040, or \177 DEL), space, tilde ~, caret ^, or colon : anywhere. +// They cannot have question-mark ?, asterisk *, or open bracket [ anywhere +var GitRefNamePatternInvalid = regexp.MustCompile(`[\000-\037\177 \\~^:?*[]+`) // CheckGitRefAdditionalRulesValid check name is valid on additional rules func CheckGitRefAdditionalRulesValid(name string) bool { - // Additional rules as described at https://www.kernel.org/pub/software/scm/git/docs/git-check-ref-format.html if strings.HasPrefix(name, "/") || strings.HasSuffix(name, "/") || strings.HasSuffix(name, ".") || strings.Contains(name, "..") || |