diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2019-10-21 18:05:58 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2019-10-21 18:05:58 +0300 |
commit | ad1e4b8fb8104b642fa79ed34fd144bc2bed8a19 (patch) | |
tree | 78f95d63d4ea5ed0b1a8b3c83c38d9cbd682f884 /lib/gitlab/config | |
parent | 664c4c7b49c6056136299817eb79e9f1de83e567 (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'lib/gitlab/config')
-rw-r--r-- | lib/gitlab/config/entry/validators.rb | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/lib/gitlab/config/entry/validators.rb b/lib/gitlab/config/entry/validators.rb index 374f929878e..8a04cca60d7 100644 --- a/lib/gitlab/config/entry/validators.rb +++ b/lib/gitlab/config/entry/validators.rb @@ -61,8 +61,15 @@ module Gitlab include LegacyValidationHelpers def validate_each(record, attribute, value) - unless validate_array_of_strings(value) - record.errors.add(attribute, 'should be an array of strings') + valid = validate_array_of_strings(value) + + record.errors.add(attribute, 'should be an array of strings') unless valid + + if valid && options[:with] + unless value.all? { |v| v =~ options[:with] } + message = options[:message] || 'contains elements that do not match the format' + record.errors.add(attribute, message) + end end end end |