Skip to content
Snippets Groups Projects
Commit f8fe394e authored by ThibG's avatar ThibG Committed by Eugen Rochko
Browse files

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

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.
parent 2a545e0f
No related branches found
No related tags found
No related merge requests found
...@@ -36,7 +36,7 @@ class FetchLinkCardService < BaseService ...@@ -36,7 +36,7 @@ class FetchLinkCardService < BaseService
def bad_url?(uri) def bad_url?(uri)
# Avoid local instance URLs and invalid URLs # 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 end
def skip_link?(a) def skip_link?(a)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment