79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
|
# File 'lib/kameleoon/utils.rb', line 79
def self.validate_top_level_domain(top_level_domain)
return nil if top_level_domain.nil? || top_level_domain.empty?
top_level_domain = top_level_domain.downcase
[HTTP, HTTPS].each do |protocol|
next unless top_level_domain.start_with?(protocol)
top_level_domain = top_level_domain[protocol.length..]
Logging::KameleoonLogger.warning(
"The top-level domain contains '%s'. Domain after protocol trimming: '%s'", protocol, top_level_domain
)
break
end
unless REGEX_DOMAIN.match?(top_level_domain)
Logging::KameleoonLogger.error("The top-level domain '%s' is invalid.", top_level_domain)
return nil
end
top_level_domain
end
|