Summary: | Certain search terms cause browser "script taking too long" error | ||
---|---|---|---|
Product: | Koha | Reporter: | Robin Sheat <robin> |
Component: | Staff interface | Assignee: | Robin Sheat <robin> |
Status: | CLOSED FIXED | QA Contact: | |
Severity: | minor | ||
Priority: | P5 - low | CC: | ago, chris, gmcharlt, jonathan.druart, koha.sekjal, paul.poulain |
Version: | 3.8 | ||
Hardware: | All | ||
OS: | All | ||
See Also: | http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=10956 | ||
Change sponsored?: | Sponsored | Patch complexity: | --- |
Documentation contact: | Documentation submission: | ||
Text to go in the release notes: | Version(s) released in: | ||
Circulation function: | |||
Attachments: |
Bug 8646 - prevent the highlighter from going infinite loop
Bug 8646 - prevent the highlighter from going infinite loop |
Description
Robin Sheat
2012-08-15 14:57:35 UTC
Created attachment 11641 [details] [review] Bug 8646 - prevent the highlighter from going infinite loop On certain search queries, for example http://koha-intra/cgi-bin/koha/catalogue/search.pl?kw=idx&q=ti:book%20 the highlighter starts going into an infinite loop until the browser decides to kill it. This patch prevents the bad input going to the highlighter. It also includes the fix on the OPAC, even though the issue doesn't come up there. Better to be safe... Created attachment 11658 [details] [review] Bug 8646 - prevent the highlighter from going infinite loop On certain search queries, for example http://koha-intra/cgi-bin/koha/catalogue/search.pl?kw=idx&q=ti:book%20 the highlighter starts going into an infinite loop until the browser decides to kill it. This patch prevents the bad input going to the highlighter. It also includes the fix on the OPAC, even though the issue doesn't come up there. Better to be safe... Signed-off-by: Jonathan Druart <jonathan.druart@biblibre.com> Works as expected. I fixed that (in BibLibre repo) with: function highlightOn() { var x; for (x in q_array) { - $("p").highlight(q_array[x]); + if ( q_array[x].length > 0 ) { + $("p").highlight(q_array[x]); + } } $(".highlight_toggle").toggle(); } But your patch looks good too. Drops empty strings are the end of the array in order to prevent infinite loops. Template only change in JS. Marking Passed QA. Patch pushed to master Pushed to 3.8.x will be in 3.8.5 |