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
This commit is contained in:
Bob Van Landuyt 2017-05-02 17:26:32 +02:00
parent 3dd2476eb3
commit 49a8e5f510

View file

@ -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)