lib/onebox/helpers.rb in onebox-2.2.6 vs lib/onebox/helpers.rb in onebox-2.2.8
- old
+ new
@@ -176,9 +176,13 @@
# expect properly encoded url, remove any unsafe chars
url.gsub!(' ', '%20')
url.gsub!("'", "'")
url.gsub!('"', """)
url.gsub!(/[^\w\-`.~:\/?#\[\]@!$&'\(\)*+,;=%\p{M}’]/, "")
+
+ parsed = Addressable::URI.parse(url)
+ return "" unless parsed.host
+
url
end
def self.get_absolute_image_url(src, url)
if src && !!(src =~ /^\/\//)