lib/onebox/engine/image_onebox.rb in onebox-1.3.8 vs lib/onebox/engine/image_onebox.rb in onebox-1.3.9
- old
+ new
@@ -4,9 +4,14 @@
include Engine
matches_regexp /^(https?:)?\/\/.+\.(png|jpg|jpeg|gif|bmp|tif|tiff)(\?.*)?$/i
def to_html
+ # Fix Dropbox image links
+ if /^https:\/\/www.dropbox.com\/s\//.match @url
+ @url.gsub!("https://www.dropbox.com","https://dl.dropboxusercontent.com")
+ end
+
"<a href='#{@url}' target='_blank'><img src='#{@url}'></a>"
end
end
end
end