##// END OF EJS Templates
Escape image filename regexp (#1971)....
Jean-Philippe Lang -
r1922:c4419e268f01
parent child
Show More
@@ -244,7 +244,7 module ApplicationHelper
244 text = text.gsub(/!((\<|\=|\>)?(\([^\)]+\))?(\[[^\]]+\])?(\{[^\}]+\})?)(\S+\.(gif|jpg|jpeg|png))!/) do |m|
244 text = text.gsub(/!((\<|\=|\>)?(\([^\)]+\))?(\[[^\]]+\])?(\{[^\}]+\})?)(\S+\.(gif|jpg|jpeg|png))!/) do |m|
245 style = $1
245 style = $1
246 filename = $6
246 filename = $6
247 rf = Regexp.new(filename, Regexp::IGNORECASE)
247 rf = Regexp.new(Regexp.escape(filename), Regexp::IGNORECASE)
248 # search for the picture in attachments
248 # search for the picture in attachments
249 if found = attachments.detect { |att| att.filename =~ rf }
249 if found = attachments.detect { |att| att.filename =~ rf }
250 image_url = url_for :only_path => only_path, :controller => 'attachments', :action => 'download', :id => found
250 image_url = url_for :only_path => only_path, :controller => 'attachments', :action => 'download', :id => found
General Comments 0
You need to be logged in to leave comments. Login now