Commit 49a8e5f5 authored by Bob Van Landuyt's avatar Bob Van Landuyt

Don't validate reserved words if the format doesn't match

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
parent 3dd2476e
...@@ -198,6 +198,7 @@ class DynamicPathValidator < ActiveModel::EachValidator ...@@ -198,6 +198,7 @@ class DynamicPathValidator < ActiveModel::EachValidator
def validate_each(record, attribute, value) def validate_each(record, attribute, value)
unless value =~ Gitlab::Regex.namespace_regex unless value =~ Gitlab::Regex.namespace_regex
record.errors.add(attribute, Gitlab::Regex.namespace_regex_message) record.errors.add(attribute, Gitlab::Regex.namespace_regex_message)
return
end end
if path_reserved_for_record?(record, value) if path_reserved_for_record?(record, value)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment