diff options
author | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2009-02-09 18:46:00 +0000 |
---|---|---|
committer | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2009-02-09 18:46:00 +0000 |
commit | bc4249e3d3edebef687acadd9b2eaadd6eefab48 (patch) | |
tree | 14be495681dce08ea526b4db4a50e2ba7f8128b1 /app/helpers/application_helper.rb | |
parent | fae04f3ae1f66c797d6f7cd08ce4e8eba1cb3df7 (diff) | |
download | redmine-bc4249e3d3edebef687acadd9b2eaadd6eefab48.tar.gz redmine-bc4249e3d3edebef687acadd9b2eaadd6eefab48.zip |
Merged r2270, r2344, r2359, r2360, r2362, r2363, r2415, r2423, r2424 from trunk.
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/branches/0.8-stable@2425 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'app/helpers/application_helper.rb')
-rw-r--r-- | app/helpers/application_helper.rb | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index 35d1670ae..c1acc5eb0 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -291,16 +291,15 @@ module ApplicationHelper attachments = attachments.sort_by(&:created_on).reverse text = text.gsub(/!((\<|\=|\>)?(\([^\)]+\))?(\[[^\]]+\])?(\{[^\}]+\})?)(\S+\.(bmp|gif|jpg|jpeg|png))!/i) do |m| style = $1 - filename = $6 - rf = Regexp.new(Regexp.escape(filename), Regexp::IGNORECASE) + filename = $6.downcase # search for the picture in attachments - if found = attachments.detect { |att| att.filename =~ rf } + if found = attachments.detect { |att| att.filename.downcase == filename } image_url = url_for :only_path => only_path, :controller => 'attachments', :action => 'download', :id => found desc = found.description.to_s.gsub(/^([^\(\)]*).*$/, "\\1") alt = desc.blank? ? nil : "(#{desc})" "!#{style}#{image_url}#{alt}!" else - "!#{style}#{filename}!" + m end end end |