summaryrefslogtreecommitdiffstats
path: root/app/helpers/application_helper.rb
diff options
context:
space:
mode:
Diffstat (limited to 'app/helpers/application_helper.rb')
-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 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