From 40b099f1a6eb88e6250075981e319882bffc3de2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9gis=20Hanol?= Date: Mon, 15 Feb 2016 12:34:45 +0100 Subject: [PATCH] FIX: keep whitespaces when replacing direct link to external images with local images --- app/jobs/regular/pull_hotlinked_images.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/jobs/regular/pull_hotlinked_images.rb b/app/jobs/regular/pull_hotlinked_images.rb index 9da1f35393b..379ad102ec2 100644 --- a/app/jobs/regular/pull_hotlinked_images.rb +++ b/app/jobs/regular/pull_hotlinked_images.rb @@ -63,7 +63,7 @@ module Jobs # Markdown reference - [x]: http:// raw.gsub!(/\[([^\]]+)\]:\s?#{escaped_src}/) { "[#{$1}]: #{url}" } # Direct link - raw.gsub!(/^#{escaped_src}\s?$/, "") + raw.gsub!(/^#{escaped_src}(\s?)$/) { "#{$1}" } end rescue => e Rails.logger.info("Failed to pull hotlinked image: #{src} post:#{post_id}\n" + e.message + "\n" + e.backtrace.join("\n"))