Bug 15722 - Patron search cannot deal with hidden characters ( tabs ) in fields
Summary: Patron search cannot deal with hidden characters ( tabs ) in fields
Status: CLOSED FIXED
Alias: None
Product: Koha
Classification: Unclassified
Component: Patrons (show other bugs)
Version: unspecified
Hardware: All All
: P5 - low normal (vote)
Assignee: Jonathan Druart
QA Contact: Testopia
URL:
Keywords:
Depends on:
Blocks: 16214
  Show dependency treegraph
 
Reported: 2016-02-02 14:10 UTC by Kyle M Hall
Modified: 2016-12-05 21:25 UTC (History)
7 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:


Attachments
Bug 15722: Escape patron infos for JSON in patron searches (6.50 KB, patch)
2016-03-08 14:13 UTC, Jonathan Druart
Details | Diff | Splinter Review
Bug 15722: Escape patron infos for JSON in patron searches (6.56 KB, patch)
2016-03-08 15:31 UTC, Kyle M Hall
Details | Diff | Splinter Review
k (6.70 KB, patch)
2016-03-24 06:54 UTC, Katrin Fischer
Details | Diff | Splinter Review
[PASSED QA] Bug 15722: Escape patron infos for JSON in patron searches (6.63 KB, patch)
2016-03-24 06:55 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 Kyle M Hall 2016-02-02 14:10:06 UTC
The patron search for a library was failing to return and was hung on "processing" what I found was that the patron's email address had a tab and a space at the end. When these were outputted in the json template members/tables/members_results.tt my browser ( chrome ) was unable to process the data giving a syntax error. I found this be recreating the query and calling svc/member/search directly from my browser.
Comment 1 Jonathan Druart 2016-03-08 11:42:01 UTC
Kyle, I don't reproduce:

 update borrowers set email="my@email.com\t " where borrowernumber=42;

Then the results are displayed correctly.
Moreover the email value is not displayed in the table.

Could you detail please?
Comment 2 Kyle M Hall 2016-03-08 12:00:31 UTC
Here is a screencast of me reproducing the issue: http://screencast.com/t/ew0siMJQU

I used Sequel Pro to insert the tab and space.
Comment 3 Ian Bays 2016-03-08 13:14:02 UTC
We have encountered this problem too in data loaded that came with unexpected tabs in the borrower data.  It was very difficult to track down.  Exactly the symptoms seen by Kyle.  No errors that we could see and nothing in the koha error logs that we could find.
Comment 4 Jonathan Druart 2016-03-08 14:13:54 UTC Comment hidden (obsolete)
Comment 5 Kyle M Hall 2016-03-08 15:31:23 UTC Comment hidden (obsolete)
Comment 6 Katrin Fischer 2016-03-24 06:54:51 UTC Comment hidden (obsolete)
Comment 7 Katrin Fischer 2016-03-24 06:55:48 UTC
Created attachment 49518 [details] [review]
[PASSED QA] Bug 15722: Escape patron infos for JSON in patron searches

If patron infos contain invalid JSON chars (\t for instance), the
results won't appear.
The solution is to escape these info.

Test plan:
Edit patron infos in DB (update borrowers set surname="foobar\t" where
borrowernumber=42)
Search for foobar (you should have more than 1 result)
Without this patch, DT retrieves a bad formatted JSON and the results
won't appear.
With this patch, the table result appears

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Comment 8 Brendan Gallagher 2016-03-24 16:15:07 UTC
Pushed to Master - Should be in May 2016 release.  Thanks!
Comment 9 Julian Maurice 2016-04-06 14:17:07 UTC
Note to myself: waiting for bug 16214 to be pushed to master, so I can push them both into 3.22.x at the same time
Comment 10 Julian Maurice 2016-04-07 05:08:19 UTC
Patch pushed to 3.22.x, will be in 3.22.6
Comment 11 Frédéric Demians 2016-04-27 15:39:20 UTC
Pushed to 3.20.x, will be in 3.20.11.