From 18489ba83a3f38e2edb1d9aecb08c47c1933e4a3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9gis=20Hanol?= Date: Wed, 11 Jun 2014 16:37:26 +0200 Subject: [PATCH] BUGFIX: proper regex escaping --- 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 6dac05405a..a736090760 100644 --- a/app/jobs/regular/pull_hotlinked_images.rb +++ b/app/jobs/regular/pull_hotlinked_images.rb @@ -48,7 +48,7 @@ module Jobs # have we successfully downloaded that file? if downloaded_urls[src].present? url = downloaded_urls[src] - escaped_src = src.gsub("?", "\\?").gsub(".", "\\.").gsub("+", "\\+") + escaped_src = Regexp.escape(src) # there are 6 ways to insert an image in a post # HTML tag - raw.gsub!(/src=["']#{escaped_src}["']/i, "src='#{url}'")