1
0
mirror of https://github.com/mastodon/mastodon.git synced 2024-12-18 09:05:06 +01:00

Fix an error when TagManager.local_url? is called with a bad URI ()

TagManager.local_url? was sometimes called with an URI with a nil host,
leading to a crash in TagManager.local_url?. This fixes moves the
already-existing uri.host.blank? check in front to avoid this case.
This commit is contained in:
ThibG 2017-06-11 22:53:12 +02:00 committed by Eugen Rochko
parent 2a545e0fb1
commit f8fe394e7a

View File

@ -36,7 +36,7 @@ class FetchLinkCardService < BaseService
def bad_url?(uri)
# Avoid local instance URLs and invalid URLs
TagManager.instance.local_url?(uri.to_s) || !%w(http https).include?(uri.scheme) || uri.host.blank?
uri.host.blank? || TagManager.instance.local_url?(uri.to_s) || !%w(http https).include?(uri.scheme)
end
def skip_link?(a)