Browse files

Escape regexp. Closes #13.

  • Loading branch information...
1 parent f579d8f commit 2cd70c61186df1f9cfcce16fb1497ee0838e2b0b @ugisozols ugisozols committed Jan 9, 2012
Showing with 1 addition and 1 deletion.
  1. +1 −1 app/views/search/show.html.erb
View
2 app/views/search/show.html.erb
@@ -9,7 +9,7 @@
<span class='result_type'>
<%= result.class.to_s.titleize %>
</span>
- <%= link_to raw(result.title.gsub(/(#{params[:query]})/i,'<mark>\1</mark>')), result_url(result) %>
+ <%= link_to raw(result.title.gsub(/(#{Regexp.escape(params[:query])})/i, '<mark>\1</mark>')), result_url(result) %>
</li>
<% end %>
</ul>

0 comments on commit 2cd70c6

Please sign in to comment.