lib/onebox/engine/standard_embed.rb in onebox-1.3.5 vs lib/onebox/engine/standard_embed.rb in onebox-1.3.6
- old
+ new
@@ -43,14 +43,16 @@
m_content = m.attribute('content').to_s.strip
m_name = m.attribute('property').to_s.gsub('og:', '')
og.metadata[m_name.to_sym] ||= []
og.metadata[m_name.to_sym].push m_content
if m_name == "image"
- image_uri = URI.parse(m_content)
- if image_uri.host.nil?
- image_uri.host = URI.parse(url).host
+ image_uri = URI.parse(m_content) rescue nil
+ if image_uri
+ if image_uri.host.nil?
+ image_uri.host = URI.parse(url).host
+ end
+ og.images.push image_uri.to_s
end
- og.images.push image_uri.to_s
elsif attrs_list.include? m_name
og.send("#{m_name}=", m_content) unless m_content.empty?
end
end
end