summaryrefslogtreecommitdiffstats
path: root/app/helpers
diff options
context:
space:
mode:
authorJean-Philippe Lang <jp_lang@yahoo.fr>2009-02-05 20:25:01 +0000
committerJean-Philippe Lang <jp_lang@yahoo.fr>2009-02-05 20:25:01 +0000
commitff0c96011fc821e15b373c3068bfa9fda1c05246 (patch)
tree73bcc1273b59bbd5d365c38b24459ee0eb1ba39b /app/helpers
parent4aa90cc072f2d2c754606f25efdedb96ee0db01b (diff)
downloadredmine-ff0c96011fc821e15b373c3068bfa9fda1c05246.tar.gz
redmine-ff0c96011fc821e15b373c3068bfa9fda1c05246.zip
Fixed: inline attached image should not match partial filename (#2683).
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@2363 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'app/helpers')
-rw-r--r--app/helpers/application_helper.rb7
1 files changed, 3 insertions, 4 deletions
diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb
index 27930ac94..552a4cde1 100644
--- a/app/helpers/application_helper.rb
+++ b/app/helpers/application_helper.rb
@@ -357,16 +357,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