diff options
author | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2007-12-19 21:06:06 +0000 |
---|---|---|
committer | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2007-12-19 21:06:06 +0000 |
commit | 5f871e965746d6c3e3642d74a321516d13aa66dc (patch) | |
tree | f7463912cd828690fdfbe8714d533fbd692133f3 /app | |
parent | bf3b2ec973a962bf7123e04ba54bc14238aefc9a (diff) | |
download | redmine-5f871e965746d6c3e3642d74a321516d13aa66dc.tar.gz redmine-5f871e965746d6c3e3642d74a321516d13aa66dc.zip |
Fixed: Textile image with style attribute cause internal server error.
Also added tests for inline images with attributes and moved auto_link and auto_mailto rules after textile rules.
git-svn-id: http://redmine.rubyforge.org/svn/trunk@1017 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'app')
-rw-r--r-- | app/helpers/application_helper.rb | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index 8deed9000..a3509b99a 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -165,16 +165,16 @@ module ApplicationHelper # when using an image link, try to use an attachment, if possible attachments = options[:attachments] if attachments - text = text.gsub(/!([<>=]*)(\S+\.(gif|jpg|jpeg|png))!/) do |m| - align = $1 - filename = $2 + text = text.gsub(/!((\<|\=|\>)?(\([^\)]+\))?(\[[^\]]+\])?(\{[^\}]+\})?)(\S+\.(gif|jpg|jpeg|png))!/) do |m| + style = $1 + filename = $6 rf = Regexp.new(filename, Regexp::IGNORECASE) # search for the picture in attachments if found = attachments.detect { |att| att.filename =~ rf } image_url = url_for :controller => 'attachments', :action => 'download', :id => found.id - "!#{align}#{image_url}!" + "!#{style}#{image_url}!" else - "!#{align}#{filename}!" + "!#{style}#{filename}!" end end end |