mirror of
https://github.com/discourse/discourse.git
synced 2025-02-25 18:55:32 -06:00
FIX: If the error is 401 unauthorized or such, just do nothing
This commit is contained in:
@@ -89,7 +89,11 @@ class TopicEmbed < ActiveRecord::Base
|
|||||||
embed_classname_whitelist = SiteSetting.embed_classname_whitelist if SiteSetting.embed_classname_whitelist.present?
|
embed_classname_whitelist = SiteSetting.embed_classname_whitelist if SiteSetting.embed_classname_whitelist.present?
|
||||||
|
|
||||||
response = FetchResponse.new
|
response = FetchResponse.new
|
||||||
html = open(URI.encode(url), allow_redirections: :safe).read
|
begin
|
||||||
|
html = open(URI.encode(url), allow_redirections: :safe).read
|
||||||
|
rescue OpenURI::HTTPError
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
raw_doc = Nokogiri::HTML(html)
|
raw_doc = Nokogiri::HTML(html)
|
||||||
auth_element = raw_doc.at('meta[@name="author"]')
|
auth_element = raw_doc.at('meta[@name="author"]')
|
||||||
|
|||||||
Reference in New Issue
Block a user