Handle URI.parse returning empty string in host instead of nil

See https://hackerone.com/reports/156615
and https://github.com/ruby/ruby/commit/dd5118f8524c425894d4716
to know more.
This commit is contained in:
Christophe Bliard
2022-12-30 11:49:20 +01:00
parent 4d03f2620b
commit d2658792c3
@@ -40,7 +40,7 @@ class SecureContextUriValidator < ActiveModel::EachValidator
end
# The URI could be parsable but not contain a host name
if uri.host.nil?
if uri.host.blank?
contract.errors.add(attribute, :invalid_url)
return
end