summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBob Van Landuyt <bob@gitlab.com>2017-05-02 17:26:32 +0200
committerBob Van Landuyt <bob@gitlab.com>2017-05-02 17:26:32 +0200
commit49a8e5f510723eb39a948efe87e1af3b0abb49f6 (patch)
treeaddbccdc88b96477ea62f7e2eba25ec79c15ee99
parent3dd2476eb395ca706763210ef1f37978889c595d (diff)
downloadgitlab-ce-30272-bvl-reject-more-namespaces.tar.gz
Don't validate reserved words if the format doesn't match30272-bvl-reject-more-namespaces
Because it also won't match the sophisticated format we have for detecting reserved names. We don't want to confuse the user with 2 error messages
-rw-r--r--app/validators/dynamic_path_validator.rb1
1 files changed, 1 insertions, 0 deletions
diff --git a/app/validators/dynamic_path_validator.rb b/app/validators/dynamic_path_validator.rb
index 7a14aed0c3e..226eb6b313c 100644
--- a/app/validators/dynamic_path_validator.rb
+++ b/app/validators/dynamic_path_validator.rb
@@ -198,6 +198,7 @@ class DynamicPathValidator < ActiveModel::EachValidator
def validate_each(record, attribute, value)
unless value =~ Gitlab::Regex.namespace_regex
record.errors.add(attribute, Gitlab::Regex.namespace_regex_message)
+ return
end
if path_reserved_for_record?(record, value)