When using "url" or "uri" template toolkit filters, I noticed that double quotes are escaped (%22), but not single quotes. This causes sometimes a problem when URL is written in JavaScript code, in a string delimited by single quotes.
Created attachment 15093 [details] [review] Proposed patch
Created attachment 15095 [details] [review] Proposed patch Added test plan and renamed bug.
Created attachment 15177 [details] [review] Bug 9554: single quote in didyoumean When using "url" or "uri" template toolkit filters, I noticed that double quotes are escaped (%22), but not single quotes. This causes sometimes a problem when URL is written in JavaScript code, in a string delimited by single quotes. This patch corrects by using double quotes for js strings. Also, adds a test for "didyoumean" feature : when feature is not activated, do not add corresponding javascript. Test plan : - activate OpacHighlightedWords syspref - activate "didyoumean" feature for OPAC - perform a search begining with a single quote (ie "'sport") => look for javascript errors (you may use firebug) Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
I'm not able to reproduce the issue. The results appear without any js errors. Could you confirm that the issue still exists?
Hello It is Rennes 2 who asked this bug to be fixed... I confirm it still exists on our preprod environnment (align on master on march 12th) error in Firebug : SyntaxError: missing ) after argument list oumean').load('/cgi-bin/koha/svc/suggestion?render=stub&q=l'histoire', M. Saby
QA comment: This patch fixes the issue. IMO, too many single quotes are change, I don't know if it is blocker. I let the RM to take the decision. Marked as Passed QA.
Created attachment 16264 [details] [review] Bug 9554: single quote in didyoumean When using "url" or "uri" template toolkit filters, I noticed that double quotes are escaped (%22), but not single quotes. This causes sometimes a problem when URL is written in JavaScript code, in a string delimited by single quotes. This patch corrects by using double quotes for js strings. Also, adds a test for "didyoumean" feature : when feature is not activated, do not add corresponding javascript. Test plan : - activate OpacHighlightedWords syspref - activate "didyoumean" feature for OPAC - perform a search begining with a single quote (ie "'sport") => look for javascript errors (you may use firebug) Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com> Signed-off-by: Jonathan Druart <jonathan.druart@biblibre.com>
This patch has been pushed to master.
This doesn't apply to 3.10.x, please rebase and submit if it is needed for 3.10.x
Created attachment 17174 [details] [review] [3.10.x] Bug 9554: single quote in didyoumean Patch rebased for 3.10.x
Pushed to 3.10.x will be in 3.10.5