Strip spaces around URL when adding a relay (#22655)
* Strip spaces around URL when adding a relay Fixes #22650 * Gracefuly handle URL parsing errors in URL validator
This commit is contained in:
@@ -10,5 +10,7 @@ class URLValidator < ActiveModel::EachValidator
|
||||
def compliant?(url)
|
||||
parsed_url = Addressable::URI.parse(url)
|
||||
parsed_url && %w(http https).include?(parsed_url.scheme) && parsed_url.host
|
||||
rescue Addressable::URI::InvalidURIError
|
||||
false
|
||||
end
|
||||
end
|
||||
|
Reference in New Issue
Block a user