diff -urN redmine-1.3.0/app/helpers/application_helper.rb redmine-1.3.0_attachments/app/helpers/application_helper.rb
--- redmine-1.3.0/app/helpers/application_helper.rb 2011-12-10 16:53:33.000000000 +0200
+++ redmine-1.3.0_attachments/app/helpers/application_helper.rb 2011-12-24 23:52:55.014742768 +0200
@@ -537,8 +537,10 @@
# when using an image link, try to use an attachment, if possible
if options[:attachments] || (obj && obj.respond_to?(:attachments))
attachments = options[:attachments] || obj.attachments
- text.gsub!(/src="([^\/"]+\.(bmp|gif|jpg|jpe|jpeg|png))"(\s+alt="([^"]*)")?/i) do |m|
- filename, ext, alt, alttext = $1.downcase, $2, $3, $4
+ text.gsub!(/((]+src\s*=\s*)|(]+href\s*=\s*))(("[^"]+")|('[^']+'))(\s+alt="([^"]*)")?/i) do |m|
+ prefix = $1
+ filename = $4.downcase.gsub(/^["'](.+)["']$/, '\1')
+ alt, alttext = $5, $6
# search for the picture in attachments
if found = Attachment.latest_attach(attachments, filename)
image_url = url_for :only_path => only_path, :controller => 'attachments',
@@ -547,7 +549,11 @@
if !desc.blank? && alttext.blank?
alt = " title=\"#{desc}\" alt=\"#{desc}\""
end
- "src=\"#{image_url}\"#{alt}".html_safe
+ if prefix =~ /^