Fixed: tokens not escaped in highlight_tokens regexp (#1702).
git-svn-id: http://redmine.rubyforge.org/svn/trunk@1709 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
parent
b26e4932a2
commit
b91bdf8798
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue