lib/omniauth-ldap/adaptor.rb in gitlab_omniauth-ldap-2.1.0 vs lib/omniauth-ldap/adaptor.rb in gitlab_omniauth-ldap-2.1.1
- old
+ new
@@ -211,11 +211,17 @@
OpenSSL::SSL::SSLContext::DEFAULT_PARAMS.dup
end
end
# Removes keys that have blank values
+ #
+ # This gem may not always be in the context of Rails so we
+ # do this rather than `.blank?`.
def sanitize_hash_values(hash)
- hash.delete_if { |_, value| value.nil? || value !~ /\S/ }
+ hash.delete_if do |_, value|
+ value.nil? ||
+ (value.is_a?(String) && value !~ /\S/)
+ end
end
def symbolize_hash_keys(hash)
hash.keys.each do |key|
hash[key.to_sym] = hash[key]