Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDouwe Maan <douwe@gitlab.com>2015-03-24 17:21:37 +0300
committerDouwe Maan <douwe@gitlab.com>2015-03-27 13:10:56 +0300
commit5f93b0e3da9f84f44c5f00af5d3e48c277d68d5b (patch)
tree3bad1fab55938d2770f9a5b6891634793c64727d /lib/gitlab/regex.rb
parentdfe0f9eedf040c6c266161239b6e2ede77c2b7dc (diff)
Don't allow username to end in period.
Diffstat (limited to 'lib/gitlab/regex.rb')
-rw-r--r--lib/gitlab/regex.rb6
1 files changed, 4 insertions, 2 deletions
diff --git a/lib/gitlab/regex.rb b/lib/gitlab/regex.rb
index 08fcf9c6dc0..0571574aa4f 100644
--- a/lib/gitlab/regex.rb
+++ b/lib/gitlab/regex.rb
@@ -2,13 +2,15 @@ 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
+
def namespace_regex
- @namespace_regex ||= /\A[a-zA-Z0-9_.][a-zA-Z0-9_\-\.]*(?<!\.git)\z/.freeze
+ @namespace_regex ||= /\A#{NAMESPACE_REGEX_STR}\z/.freeze
end
def namespace_regex_message
"can contain only letters, digits, '_', '-' and '.'. " \
- "Cannot start with '-' or end in '.git'" \
+ "Cannot start with '-' or end in '.'." \
end