FIX: keep whitespaces when replacing direct link to external images with local images

This commit is contained in:
Régis Hanol 2016-02-15 12:34:45 +01:00
parent 482a65821b
commit 40b099f1a6

View File

@ -63,7 +63,7 @@ module Jobs
# Markdown reference - [x]: http://
raw.gsub!(/\[([^\]]+)\]:\s?#{escaped_src}/) { "[#{$1}]: #{url}" }
# Direct link
raw.gsub!(/^#{escaped_src}\s?$/, "<img src='#{url}'>")
raw.gsub!(/^#{escaped_src}(\s?)$/) { "<img src='#{url}'>#{$1}" }
end
rescue => e
Rails.logger.info("Failed to pull hotlinked image: #{src} post:#{post_id}\n" + e.message + "\n" + e.backtrace.join("\n"))