mirror of
https://github.com/discourse/discourse.git
synced 2025-02-25 18:55:32 -06:00
Oneboxes shouldn't explode when the remote causes an HTTPError
This commit is contained in:
parent
921c3f016f
commit
702fbcdfa8
@ -42,7 +42,7 @@ module Oneboxer
|
|||||||
end
|
end
|
||||||
(doc/"link[@type='text/json+oembed']").each do |oembed|
|
(doc/"link[@type='text/json+oembed']").each do |oembed|
|
||||||
return OembedOnebox.new(oembed[:href]).onebox
|
return OembedOnebox.new(oembed[:href]).onebox
|
||||||
end
|
end
|
||||||
|
|
||||||
# Check for opengraph
|
# Check for opengraph
|
||||||
open_graph = Oneboxer.parse_open_graph(doc)
|
open_graph = Oneboxer.parse_open_graph(doc)
|
||||||
@ -50,7 +50,9 @@ module Oneboxer
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
nil
|
nil
|
||||||
|
rescue OpenURI::HTTPError
|
||||||
|
nil
|
||||||
end
|
end
|
||||||
|
|
||||||
# Parse URLs out of HTML, returning the document when finished.
|
# Parse URLs out of HTML, returning the document when finished.
|
||||||
|
Loading…
Reference in New Issue
Block a user