Commit c4419e26 authored by Jean-Philippe Lang's avatar Jean-Philippe Lang

Escape image filename regexp (#1971).

git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@1924 e93f8b46-1217-0410-a6f0-8f06a7374b81
parent cf1ad65c
......@@ -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
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment