diff options
author | Eric Davis <edavis@littlestreamsoftware.com> | 2010-06-24 02:35:24 +0000 |
---|---|---|
committer | Eric Davis <edavis@littlestreamsoftware.com> | 2010-06-24 02:35:24 +0000 |
commit | 6eea3300f88a943015979a22d224c3c51799cb45 (patch) | |
tree | 1c8a4b9be9e6dc9f4e26d8314a8dfb6dac999869 /lib | |
parent | 68bdbbac7d7d954182837be9afcce9d5aaf5e705 (diff) | |
download | redmine-6eea3300f88a943015979a22d224c3c51799cb45.tar.gz redmine-6eea3300f88a943015979a22d224c3c51799cb45.zip |
Sanitize image links and handle nils in the toc formatter. #5445
Based on contribution by Yuki Kita.
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@3811 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'lib')
-rw-r--r-- | lib/redmine/wiki_formatting/textile/formatter.rb | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/lib/redmine/wiki_formatting/textile/formatter.rb b/lib/redmine/wiki_formatting/textile/formatter.rb index abffdbcbf..a622e8039 100644 --- a/lib/redmine/wiki_formatting/textile/formatter.rb +++ b/lib/redmine/wiki_formatting/textile/formatter.rb @@ -67,7 +67,9 @@ module Redmine toc_item = content.gsub(/(\[\[([^\]\|]*)(\|([^\]]*))?\]\])/) { $4 || $2 } # sanitizes titles from links # see redcloth3.rb, same as "#{pre}#{text}#{post}" - toc_item.gsub!(LINK_RE) { $2+$4+$9 } + toc_item.gsub!(LINK_RE) { [$2, $4, $9].join } + # sanitizes image links from titles + toc_item.gsub!(IMAGE_RE) { [$5].join } # removes styles # eg. %{color:red}Triggers% => Triggers toc_item.gsub! %r[%\{[^\}]*\}([^%]+)%], '\\1' |