diff options
author | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2008-07-28 21:11:49 +0000 |
---|---|---|
committer | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2008-07-28 21:11:49 +0000 |
commit | b91bdf8798360aa913ac97167c4925f95faa3673 (patch) | |
tree | 420c83d3a4388a94b1531a22e17d5bd699610958 /app | |
parent | b26e4932a26cabd0d3adc5943a2836ac2eae2aee (diff) | |
download | redmine-b91bdf8798360aa913ac97167c4925f95faa3673.tar.gz redmine-b91bdf8798360aa913ac97167c4925f95faa3673.zip |
Fixed: tokens not escaped in highlight_tokens regexp (#1702).
git-svn-id: http://redmine.rubyforge.org/svn/trunk@1709 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'app')
-rw-r--r-- | app/helpers/search_helper.rb | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/app/helpers/search_helper.rb b/app/helpers/search_helper.rb index 92f2da8a5..cd96dbd3f 100644 --- a/app/helpers/search_helper.rb +++ b/app/helpers/search_helper.rb @@ -18,7 +18,8 @@ module SearchHelper def highlight_tokens(text, tokens) return text unless text && tokens && !tokens.empty? - regexp = Regexp.new "(#{tokens.join('|')})", Regexp::IGNORECASE + re_tokens = tokens.collect {|t| Regexp.escape(t)} + regexp = Regexp.new "(#{re_tokens.join('|')})", Regexp::IGNORECASE result = '' text.split(regexp).each_with_index do |words, i| if result.length > 1200 |