Skip to content

Commit

Permalink
Escape regexp. Closes #13.
Browse files Browse the repository at this point in the history
  • Loading branch information
ugisozols committed Jan 9, 2012
1 parent f579d8f commit 2cd70c6
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion app/views/search/show.html.erb
Expand Up @@ -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>
Expand Down

0 comments on commit 2cd70c6

Please sign in to comment.