Bug 12071 - javascript broken for a search with double quotes
Summary: javascript broken for a search with double quotes
Status: CLOSED FIXED
Alias: None
Product: Koha
Classification: Unclassified
Component: Staff interface (show other bugs)
Version: Main
Hardware: All All
: P5 - low minor
Assignee: Fridolin Somers
QA Contact: Testopia
URL:
Keywords:
: 13038 (view as bug list)
Depends on:
Blocks:
 
Reported: 2014-04-11 08:54 UTC by Fridolin Somers
Modified: 2015-06-04 23:30 UTC (History)
3 users (show)

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


Attachments
Bug 12071 - javascript broken for a search with double quotes (4.89 KB, patch)
2014-04-11 09:04 UTC, Fridolin Somers
Details | Diff | Splinter Review
Patch fixes encoding problem as well (e.g. äöü) (74.92 KB, image/png)
2014-04-15 08:31 UTC, Marc Véron
Details
[SIGNED-OFF] Bug 12071 - javascript broken for a search with double quotes (5.22 KB, patch)
2014-04-15 08:35 UTC, Marc Véron
Details | Diff | Splinter Review
[PASSED QA] Bug 12071 - Javascript broken for a search with double quotes (5.45 KB, patch)
2014-04-17 19:02 UTC, Katrin Fischer
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description Fridolin Somers 2014-04-11 08:54:38 UTC
In staff interface, when performing a simple search with a double quote (ie "histoire algerie"), the javascript is broken in results page because of :

function GetZ3950Terms(){
  var strQuery="&frameworkcode=";
  strQuery += "&" + "title" + "=" + ""histoire%20algerie"";

Double quotes are not URI-escaped.
Comment 1 Fridolin Somers 2014-04-11 09:04:31 UTC Comment hidden (obsolete)
Comment 2 Owen Leonard 2014-04-11 15:20:42 UTC
I can't reproduce this bug in master.
Comment 3 Fridolin Somers 2014-04-14 13:00:11 UTC
(In reply to Owen Leonard from comment #2)
> I can't reproduce this bug in master.
I found it occurs on a server with Debian Squeeze and not on my laptop with Ubuntu 13.10, maybe a difference in library URI::Escape.
Still it must be corrected because most of libraries servers run Debian Squeeze.
Also, escaping URL characters into TT is a better code, regarding to MVC layers.
Comment 4 Marc Véron 2014-04-15 08:31:08 UTC
Created attachment 27116 [details]
Patch fixes encoding problem as well (e.g. äöü)

I tryed to reproduce the problem and found an other one: If you do a search for someting like äöü and then hit Z39.50 button, the encoding in the Z39.50 search form is broken. With patch, the encoding is correct.
Comment 5 Marc Véron 2014-04-15 08:35:50 UTC Comment hidden (obsolete)
Comment 6 Katrin Fischer 2014-04-17 19:02:18 UTC
Created attachment 27272 [details] [review]
[PASSED QA] Bug 12071 - Javascript broken for a search with double quotes

In staff interface, when performing a simple search with
a double quote (ie "histoire algerie"), the javascript
is broken in results page because of :

function GetZ3950Terms(){
  var strQuery="&frameworkcode=";
  strQuery += "&" + "title" + "=" + ""histoire%20algerie"";

This patch moves URI escaping from perl to template with uri TT filter.

Test plan :
- In staff interface, perform a search with double quotes
  that will return no result, ie "aaa xxx"
=> Without patch, javascript is broken
=> With patch, javascript is not broken
- Click on Z3950 button on results page
=> Without patch, the Title input is empty
=> With patch, the Title input contains the search terms

Additional test:
Do a search with something like äöü and then click Z3950
button on results page.
Without patch, encoding is broken in Z3950 form
With patch, encoding is correct.

Signed-off-by: Marc Véron <veron@veron.ch>
Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de>
Fixed a few tabs. Passes tests and QA script.
I can't reproduce the Javascript problem, but I can reproduce
the Z39.50 encoding problem and can detect no regression.
Comment 7 Galen Charlton 2014-04-18 15:51:57 UTC
Pushed to master, thanks Fridolin!
Comment 8 Fridolin Somers 2014-08-01 13:23:24 UTC
Pushed to 3.14.x, will be in 3.14.10
Comment 9 Nicole C. Engard 2014-10-08 12:44:45 UTC
*** Bug 13038 has been marked as a duplicate of this bug. ***