1
0
Fork 0
forked from fedi/mastodon

Fix TagManager#local_url? erroring out on invalid URL (#18580)

This commit is contained in:
Claire 2022-05-31 18:25:24 +02:00 committed by GitHub
parent 14d7cf39f4
commit 28212bd2be
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -24,8 +24,11 @@ class TagManager
def local_url?(url) def local_url?(url)
uri = Addressable::URI.parse(url).normalize uri = Addressable::URI.parse(url).normalize
return false unless uri.host
domain = uri.host + (uri.port ? ":#{uri.port}" : '') domain = uri.host + (uri.port ? ":#{uri.port}" : '')
TagManager.instance.web_domain?(domain) TagManager.instance.web_domain?(domain)
rescue Addressable::URI::InvalidURIError
false
end end
end end