lib/onebox/engine/standard_embed.rb in onebox-1.8.27 vs lib/onebox/engine/standard_embed.rb in onebox-1.8.28
- old
+ new
@@ -117,14 +117,14 @@
def get_favicon
return nil unless html_doc
favicon = html_doc.css('link[rel="shortcut icon"], link[rel="icon shortcut"], link[rel="shortcut"], link[rel="icon"]').first
- favicon = favicon.nil? ? nil : favicon['href']&.strip
+ favicon = favicon.nil? ? nil : (favicon['href'].nil? ? nil : favicon['href'].strip)
if favicon && favicon.match(/^https?:\/\//i).nil?
uri = URI(url)
- favicon = uri.scheme + "://" + uri.host.sub(/\/$/,"") + "/" + favicon.sub(/^\//,"")
+ favicon = uri.scheme + "://" + uri.host.sub(/\/$/, "") + "/" + favicon.sub(/^\//, "")
end
favicon
end
end