diff --git a/app/models/article.rb b/app/models/article.rb index d34f8d0..016e73f 100644 --- a/app/models/article.rb +++ b/app/models/article.rb @@ -730,7 +730,12 @@ class Article < ActiveRecord::Base def body_images_paths require 'uri' Hpricot(self.body.to_s).search('img[@src]').collect do |i| - (self.profile && self.profile.environment) ? URI.join(self.profile.environment.top_url, URI.escape(i.attributes['src'])).to_s : i.attributes['src'] + begin + (self.profile && self.profile.environment) ? URI.join(self.profile.environment.top_url, URI.escape(i.attributes['src'], '[|]')).to_s : i.attributes['src'] + rescue + # some uris are invalid but still visible on modern browsers (e.g.: uri with square brackets) + i.attributes['src'] + end end end -- libgit2 0.21.2