lib/onebox/engine/google_docs_onebox.rb in onebox-1.7.5 vs lib/onebox/engine/google_docs_onebox.rb in onebox-1.7.6
- old
+ new
@@ -43,11 +43,11 @@
def match
@match ||= @url.match(@@matcher)
end
def get_og_data
- response = Onebox::Helpers.fetch_response(url, 10)
- html = Nokogiri::HTML(response.body)
+ response = Onebox::Helpers.fetch_response(url, 10) rescue nil
+ html = Nokogiri::HTML(response)
og_data = {}
html.css('meta').each do |m|
if m.attribute('property') && m.attribute('property').to_s.match(/^og:/i)
m_content = m.attribute('content').to_s.strip
m_property = m.attribute('property').to_s.gsub('og:', '')