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@selenight.nl>2017-05-23 04:08:33 +0300
committerDouwe Maan <douwe@selenight.nl>2017-05-24 04:38:35 +0300
commitb0498c176fa134761d899c9b369be12f1ca789c5 (patch)
treedcf223813e0b1bb5932a94793a6f827771517a96 /app/validators
parented16c351c5acdf1ad2e401e72490320d06af6e91 (diff)
Remove changes that are not absolutely necessary
Diffstat (limited to 'app/validators')
-rw-r--r--app/validators/dynamic_path_validator.rb22
1 files changed, 8 insertions, 14 deletions
diff --git a/app/validators/dynamic_path_validator.rb b/app/validators/dynamic_path_validator.rb
index 6819886ebf4..8d4d7180baf 100644
--- a/app/validators/dynamic_path_validator.rb
+++ b/app/validators/dynamic_path_validator.rb
@@ -3,20 +3,16 @@
# Custom validator for GitLab path values.
# These paths are assigned to `Namespace` (& `Group` as a subclass) & `Project`
#
-# Values are checked for formatting and exclusion from a list of illegal path
+# Values are checked for formatting and exclusion from a list of reserved path
# names.
class DynamicPathValidator < ActiveModel::EachValidator
class << self
- def valid_user_path?(path)
- "#{path}/" =~ Gitlab::PathRegex.root_namespace_path_regex
- end
-
- def valid_group_path?(path)
- "#{path}/" =~ Gitlab::PathRegex.full_namespace_path_regex
+ def valid_namespace_path?(path)
+ "#{path}/" =~ Gitlab::Regex.full_namespace_path_regex
end
def valid_project_path?(path)
- "#{path}/" =~ Gitlab::PathRegex.full_project_path_regex
+ "#{path}/" =~ Gitlab::Regex.full_project_path_regex
end
end
@@ -28,16 +24,14 @@ class DynamicPathValidator < ActiveModel::EachValidator
case record
when Project
self.class.valid_project_path?(full_path)
- when Group
- self.class.valid_group_path?(full_path)
- else # User or non-Group Namespace
- self.class.valid_user_path?(full_path)
+ else
+ self.class.valid_namespace_path?(full_path)
end
end
def validate_each(record, attribute, value)
- unless value =~ Gitlab::PathRegex.namespace_format_regex
- record.errors.add(attribute, Gitlab::PathRegex.namespace_format_message)
+ unless value =~ Gitlab::Regex.namespace_regex
+ record.errors.add(attribute, Gitlab::Regex.namespace_regex_message)
return
end