Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorReuben Pereira <rpereira@gitlab.com>2019-07-31 09:54:03 +0300
committerJames Lopez <james@gitlab.com>2019-07-31 09:54:03 +0300
commit5c7f2853dc5a8eca874108a0217a115090f29e9b (patch)
tree15e22a546814fa495fbb00ce1fdfbf2efa97a1d2 /app/models/application_setting_implementation.rb
parent67ffe3ced0a704d78f528e5dc8ea4243e5e4a47f (diff)
Allow blank but not nil in validations
- The most common use case for qualified_domain_validator currently is to allow blank ([]) but not allow nil. Modify the qualified_domain_validator to support this use case.
Diffstat (limited to 'app/models/application_setting_implementation.rb')
-rw-r--r--app/models/application_setting_implementation.rb4
1 files changed, 4 insertions, 0 deletions
diff --git a/app/models/application_setting_implementation.rb b/app/models/application_setting_implementation.rb
index 1e612bd0e78..6efd07a6008 100644
--- a/app/models/application_setting_implementation.rb
+++ b/app/models/application_setting_implementation.rb
@@ -163,6 +163,8 @@ module ApplicationSettingImplementation
def outbound_local_requests_whitelist_arrays
strong_memoize(:outbound_local_requests_whitelist_arrays) do
+ next [[], []] unless self.outbound_local_requests_whitelist
+
ip_whitelist = []
domain_whitelist = []
@@ -284,6 +286,8 @@ module ApplicationSettingImplementation
end
def domain_strings_to_array(values)
+ return [] unless values
+
values
.split(DOMAIN_LIST_SEPARATOR)
.reject(&:empty?)