From c4419e268f01eb964181cfbe16db66c6e7a7cd1e Mon Sep 17 00:00:00 2001 From: Jean-Philippe Lang Date: Sat, 4 Oct 2008 17:38:31 +0000 Subject: [PATCH] Escape image filename regexp (#1971). git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@1924 e93f8b46-1217-0410-a6f0-8f06a7374b81 --- app/helpers/application_helper.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index c3701b377..0a4aab2b9 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -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 -- 2.39.5