Bug 12885

Summary: Search fails with errors when HTML5 Media is enabled and url has plus (+) characters
Product: Koha Reporter: Kyle M Hall <kyle>
Component: SearchingAssignee: Jonathan Druart <jonathan.druart>
Status: CLOSED FIXED QA Contact: Testopia <testopia>
Severity: major    
Priority: P5 - low CC: chris, jonathan.druart, katrin.fischer, liz, mirko, tomascohen
Version: unspecified   
Hardware: All   
OS: All   
Change sponsored?: --- Patch complexity: Trivial patch
Documentation contact: Documentation submission:
Text to go in the release notes:
Version(s) released in:
Attachments: Bug 12885: Fix if url contains +*... and HTML5 Media is enabled
Bug 12885: Fix if url contains +*... and HTML5 Media is enabled
Bug 12885: Fix if url contains +*... and HTML5 Media is enabled
[PASSED QA] Bug 12885: Fix if url contains +*... and HTML5 Media is enabled

Description Kyle M Hall 2014-09-08 12:53:02 UTC
For example, the following URL in 856$u:

http://www.mrqe.com/lookup?talented+mr.+ripley

will trigger the following error:

Quantifier follows nothing in regex; marked by <-- HERE in m/+ <-- HERE ripley/ at /var/lib/koha/coos/kohaclone/C4/HTML5Media.pm line 113.

This will make all searches where the record in question is in the results impossible. You will get the error instead of search results.
Comment 1 Jonathan Druart 2015-07-15 11:51:52 UTC Comment hidden (obsolete)
Comment 2 Mirko Tietgen 2015-07-28 08:07:35 UTC Comment hidden (obsolete)
Comment 3 Joonas Kylmälä 2015-08-17 06:10:39 UTC Comment hidden (obsolete)
Comment 4 Katrin Fischer 2015-09-01 21:52:02 UTC
Created attachment 42182 [details] [review]
[PASSED QA] Bug 12885: Fix if url contains +*... and HTML5 Media is enabled

The special regex chars are not escaped in C4::HTML5Media.

Test plan:
1/ Set 856$u=http://www.mrqe.com/lookup?talented+mr.+ripley
2/ Enable the pref HTML5Media
3/ Go on the detail page
It should not explode.

Signed-off-by: Mirko Tietgen <mirko@abunchofthings.net>
Signed-off-by: Joonas Kylmälä <j.kylmala@gmail.com>

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Comment 5 Tomás Cohen Arazi 2015-09-02 17:48:08 UTC
Patch pushed to master.

Thanks Jonathan!
Comment 6 Chris Cormack 2015-09-22 01:37:16 UTC
Pushed to 3.20.x will be in 3.20.4
Comment 7 Liz Rea 2015-09-22 02:29:20 UTC
Pushed to 3.18.x will be in 3.18.11.