Bug 9554 - single quote in didyoumean
Summary: single quote in didyoumean
Status: CLOSED FIXED
Alias: None
Product: Koha
Classification: Unclassified
Component: Templates (show other bugs)
Version: Main
Hardware: All All
: P5 - low normal (vote)
Assignee: Fridolin Somers
QA Contact: Jonathan Druart
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-02-06 13:37 UTC by Fridolin Somers
Modified: 2014-05-26 21:04 UTC (History)
4 users (show)

See Also:
Change sponsored?: ---
Patch complexity: Small patch
Documentation contact:
Documentation submission:
Text to go in the release notes:
Version(s) released in:


Attachments
Proposed patch (5.20 KB, patch)
2013-02-06 13:40 UTC, Fridolin Somers
Details | Diff | Splinter Review
Proposed patch (5.56 KB, patch)
2013-02-06 13:48 UTC, Fridolin Somers
Details | Diff | Splinter Review
Bug 9554: single quote in didyoumean (5.61 KB, patch)
2013-02-08 16:59 UTC, Kyle M Hall
Details | Diff | Splinter Review
Bug 9554: single quote in didyoumean (5.58 KB, patch)
2013-03-18 15:21 UTC, Jonathan Druart
Details | Diff | Splinter Review
[3.10.x] Bug 9554: single quote in didyoumean (5.58 KB, patch)
2013-04-03 15:08 UTC, Fridolin Somers
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description Fridolin Somers 2013-02-06 13:37:10 UTC
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.
Comment 1 Fridolin Somers 2013-02-06 13:40:18 UTC Comment hidden (obsolete)
Comment 2 Fridolin Somers 2013-02-06 13:48:56 UTC Comment hidden (obsolete)
Comment 3 Kyle M Hall 2013-02-08 16:59:04 UTC Comment hidden (obsolete)
Comment 4 Jonathan Druart 2013-03-11 13:29:23 UTC
I'm not able to reproduce the issue.
The results appear without any js errors.
Could you confirm that the issue still exists?
Comment 5 Mathieu Saby 2013-03-18 14:35:02 UTC
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
Comment 6 Jonathan Druart 2013-03-18 15:16:42 UTC
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.
Comment 7 Jonathan Druart 2013-03-18 15:21:27 UTC
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>
Comment 8 Jared Camins-Esakov 2013-03-20 01:02:12 UTC
This patch has been pushed to master.
Comment 9 Chris Cormack 2013-03-29 06:29:29 UTC
This doesn't apply to 3.10.x, please rebase and submit if it is needed for 3.10.x
Comment 10 Fridolin Somers 2013-04-03 15:08:12 UTC
Created attachment 17174 [details] [review]
[3.10.x] Bug 9554: single quote in didyoumean

Patch rebased for 3.10.x
Comment 11 Chris Cormack 2013-04-03 19:37:04 UTC
Pushed to 3.10.x will be in 3.10.5