diff options
author | Will Starms <vilhelmen@gmail.com> | 2016-08-25 19:48:08 +0300 |
---|---|---|
committer | Will Starms <vilhelmen@gmail.com> | 2016-10-07 21:46:59 +0300 |
commit | 4f1de5faacb6824bad2624b75537e9f4ddbb1207 (patch) | |
tree | b60a2b249f3039dc37854725a0c96a2ecbe0f8ab /lib | |
parent | c901936a829885263a602431e5762b0352073a2a (diff) |
Correct namespace validation to forbid bad names #21077
Adds .git and .atom to the master namespace regex
Updates existing group tests and adds two new ones
Updates path cleaning to also forbid .atom
Diffstat (limited to 'lib')
-rw-r--r-- | lib/gitlab/regex.rb | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/gitlab/regex.rb b/lib/gitlab/regex.rb index 776bbcbb5d0..0d30e1bb92e 100644 --- a/lib/gitlab/regex.rb +++ b/lib/gitlab/regex.rb @@ -2,7 +2,7 @@ module Gitlab module Regex extend self - NAMESPACE_REGEX_STR = '(?:[a-zA-Z0-9_\.][a-zA-Z0-9_\-\.]*[a-zA-Z0-9_\-]|[a-zA-Z0-9_])'.freeze + NAMESPACE_REGEX_STR = '(?:[a-zA-Z0-9_\.][a-zA-Z0-9_\-\.]*[a-zA-Z0-9_\-]|[a-zA-Z0-9_])(?<!\.git|\.atom)'.freeze def namespace_regex @namespace_regex ||= /\A#{NAMESPACE_REGEX_STR}\z/.freeze @@ -10,7 +10,7 @@ module Gitlab def namespace_regex_message "can contain only letters, digits, '_', '-' and '.'. " \ - "Cannot start with '-' or end in '.'." \ + "Cannot start with '-' or end in '.', '.git' or '.atom'." \ end def namespace_name_regex |