summaryrefslogtreecommitdiff
path: root/app/validators
diff options
context:
space:
mode:
authorBob Van Landuyt <bob@gitlab.com>2017-04-12 09:44:05 +0200
committerBob Van Landuyt <bob@gitlab.com>2017-05-01 11:14:24 +0200
commit3143a5d2602de521b432231d701aedcc2844c088 (patch)
treefa1e4efbef26d0438437db2ef29f91cf995ed18c /app/validators
parent1498a9cb0fb4500737c9d9e88f38c0ddf2b42791 (diff)
downloadgitlab-ce-3143a5d2602de521b432231d701aedcc2844c088.tar.gz
Use the namespace validator for validating all paths
Since the namespacevalidator now knows the difference between a top-level and another path, this could all be handled there.
Diffstat (limited to 'app/validators')
-rw-r--r--app/validators/project_path_validator.rb27
1 files changed, 0 insertions, 27 deletions
diff --git a/app/validators/project_path_validator.rb b/app/validators/project_path_validator.rb
deleted file mode 100644
index d41bdaeab84..00000000000
--- a/app/validators/project_path_validator.rb
+++ /dev/null
@@ -1,27 +0,0 @@
-# ProjectPathValidator
-#
-# Custom validator for GitLab project path values.
-#
-# Values are checked for formatting and exclusion from a list of reserved path
-# names.
-#
-# This is basically the same as the `NamespaceValidator` but it skips the validation
-# of the format with `Gitlab::Regex.namespace_regex`. The format of projects
-# is validated in the class itself.
-class ProjectPathValidator < NamespaceValidator
- def self.valid?(value)
- !reserved?(value)
- end
-
- def self.reserved?(value, type: :wildcard)
- super(value, type: :wildcard)
- end
-
- delegate :reserved?, to: :class
-
- def validate_each(record, attribute, value)
- if reserved?(value)
- record.errors.add(attribute, "#{value} is a reserved name")
- end
- end
-end