Skip to content

Problem in search show view with regex #13

Closed
agronemann opened this Issue Jan 8, 2012 · 7 comments

2 participants

@agronemann

Hello!

There is a problem with this line of code in the searches show view (Line 12):

<%= link_to raw(result.title.gsub(/(#{params[:query]})/i,'<mark>\1</mark>')), result_url(result) %>

When the query param contains regex like characters it goes nuts (of course).

@ugisozols
Refinery member

Hey @Highcode,

Would you be willing to fix this? Thanks.

@agronemann

I not sure how to make a fix for this, sorry. :-(

@ugisozols
Refinery member

Don't worry - I'll take a look at it tomorrow.

@agronemann

Cool! You do not hurry on my account. Have a nice day! :-)

@ugisozols
Refinery member

Can you post steps to reproduce? I can't break it myself :)

@agronemann

Try to search for:

Hello world :-)

Then the gsub will look like this:

gsub(/(Hello world :-))/i,'<mark>\1</mark>')

Which fails.

@ugisozols ugisozols closed this in 2cd70c6 Jan 9, 2012
@ugisozols
Refinery member

@Highcode please test it and let me know if it works for you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.