]> source.dussan.org Git - redmine.git/commitdiff
Escape image filename regexp (#1971).
authorJean-Philippe Lang <jp_lang@yahoo.fr>
Sat, 4 Oct 2008 17:38:31 +0000 (17:38 +0000)
committerJean-Philippe Lang <jp_lang@yahoo.fr>
Sat, 4 Oct 2008 17:38:31 +0000 (17:38 +0000)
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@1924 e93f8b46-1217-0410-a6f0-8f06a7374b81

app/helpers/application_helper.rb

index c3701b37767647972edcfc6d7604a8c17f294ff3..0a4aab2b987cce2fd7bd24a4931ade492d67fb9b 100644 (file)
@@ -244,7 +244,7 @@ module ApplicationHelper
       text = text.gsub(/!((\<|\=|\>)?(\([^\)]+\))?(\[[^\]]+\])?(\{[^\}]+\})?)(\S+\.(gif|jpg|jpeg|png))!/) do |m|
         style = $1
         filename = $6
-        rf = Regexp.new(filename,  Regexp::IGNORECASE)
+        rf = Regexp.new(Regexp.escape(filename),  Regexp::IGNORECASE)
         # search for the picture in attachments
         if found = attachments.detect { |att| att.filename =~ rf }
           image_url = url_for :only_path => only_path, :controller => 'attachments', :action => 'download', :id => found