[Bug 13812] New: Facet links broken when shelf location limit is used.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=13812 Bug ID: 13812 Summary: Facet links broken when shelf location limit is used. Change sponsored?: --- Product: Koha Version: unspecified Hardware: All OS: All Status: NEW Severity: enhancement Priority: P5 - low Component: Searching Assignee: gmcharlt@gmail.com Reporter: barton@bywatersolutions.com QA Contact: testopia@bugs.koha-community.org This bug is analogous to Bug 13442, but it affects shelf location rather than collection code: Limiting a search by shelf location is broken, because it wraps double-quotes around the "value" part of the key-value pair in the URL. This breaks the href= part of the anchor tag. The anchor tag generated for the shelf location faced is <a href="/cgi-bin/koha/opac-search.pl?&limit=mc-loc%3A"100100ADFICCF"&limit=mc-loc%3A"100200ADFIC"&limit=mc-loc%3A"100250ADFICGN"&limit=mc-loc%3A"100300ADFICHF"&limit=yr%2Cst-numeric%3D2014-&sort_by=acqdate_dsc&limit=au:Paetro%2C%20Maxine%2C" title="Paetro, Maxine,">Paetro, Maxine,</a> Once again, double-quotes inside the URL are causing a premature close of the href, which results in a broken link. I think that we need to take a look for code duplication inside C4::Search::buildQuery -- if there's more than one section of code where we're wrapping quotes around the 'value' part of the query, these should be consolidated -- shouldn't we be using URL encoding for URL reserved characters anyway? -- You are receiving this mail because: You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=13812 Barton Chittenden <barton@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- See Also| |http://bugs.koha-community. | |org/bugzilla3/show_bug.cgi? | |id=13442 -- You are receiving this mail because: You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=13812 Barton Chittenden <barton@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Summary|Facet links broken when |Facet links broken because |shelf location limit is |double-quotes are not URL |used. |encoded. --- Comment #1 from Barton Chittenden <barton@bywatersolutions.com> --- (In reply to Barton Chittenden from comment #0)
This bug is analogous to Bug 13442, but it affects shelf location rather than collection code:
Limiting a search by shelf location is broken, because it wraps double-quotes around the "value" part of the key-value pair in the URL. This breaks the href= part of the anchor tag.
The anchor tag generated for the shelf location faced is
<a href="/cgi-bin/koha/opac-search.pl?&limit=mc-loc%3A"100100ADFICCF"&limit=mc- loc%3A"100200ADFIC"&limit=mc-loc%3A"100250ADFICGN"&limit=mc- loc%3A"100300ADFICHF"&limit=yr%2Cst-numeric%3D2014-& sort_by=acqdate_dsc&limit=au:Paetro%2C%20Maxine%2C" title="Paetro, Maxine,">Paetro, Maxine,</a>
Once again, double-quotes inside the URL are causing a premature close of the href, which results in a broken link.
I think that we need to take a look for code duplication inside C4::Search::buildQuery -- if there's more than one section of code where we're wrapping quotes around the 'value' part of the query, these should be consolidated -- shouldn't we be using URL encoding for URL reserved characters anyway?
I found another example, this time in facets under Subject: Starting here: https://library.roseville.ca.us/cgi-bin/koha/opac-detail.pl?biblionumber=35767&query_desc=kw%2Cwrdl%3A%20Fairies Click on Subject: Faries ... this leads us here: https://library.roseville.ca.us/cgi-bin/koha/opac-search.pl?q=su:"Fairies." All of the facets on this page are broken, because the quotes are passed straight in, without being URL encoded. Here's an example from the HTML of that page: <span class="facet-label"><a href="/cgi-bin/koha/opac-search.pl?q=ccl=su%3A"Fairies."&sort_by=relevance_asc&limit=su-to:Magic" title="Magic">Magic</a></span> -- You are receiving this mail because: You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=13812 jdemuth@roseville.ca.us <jdemuth@roseville.ca.us> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |jdemuth@roseville.ca.us -- You are receiving this mail because: You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=13812 Nicole C. Engard <nengard@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |nengard@gmail.com Severity|enhancement |normal Version|unspecified |master -- You are receiving this mail because: You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=13812 --- Comment #2 from Kyle M Hall <kyle@bywatersolutions.com> --- Created attachment 37528 --> http://bugs.koha-community.org/bugzilla3/attachment.cgi?id=37528&action=edit Bug 13812 - Facet links broken because double-quotes are not URL encoded. This bug is analogous to Bug 13442, but it affects shelf location rather than collection code: Limiting a search by shelf location is broken, because it wraps double-quotes around the "value" part of the key-value pair in the URL. This breaks the href= part of the anchor tag. The anchor tag generated for the shelf location faced is <a href="/cgi-bin/koha/opac-search.pl?&limit=mc-loc%3A"100100ADFICCF"&limit=mc-loc%3A"100200ADFIC"&limit=mc-loc%3A"100250ADFICGN"&limit=mc-loc%3A"100300ADFICHF"&limit=yr%2Cst-numeric%3D2014-&sort_by=acqdate_dsc&limit=au:Paetro%2C%20Maxine%2C" title="Paetro, Maxine,">Paetro, Maxine,</a> Once again, double-quotes inside the URL are causing a premature close of the href, which results in a broken link. http://bugs.koha-community.org/show_bug.cgi?id=13821 -- You are receiving this mail because: You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=13812 Kyle M Hall <kyle@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |kyle@bywatersolutions.com Status|NEW |Needs Signoff --- Comment #3 from Kyle M Hall <kyle@bywatersolutions.com> --- Patch removes quotes. Another possibility would be to escape or encode the quotes, but I'm not well versed enough with the XSLT to do so. -- You are receiving this mail because: You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=13812 David Cook <dcook@prosentient.com.au> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |dcook@prosentient.com.au --- Comment #4 from David Cook <dcook@prosentient.com.au> --- (In reply to Kyle M Hall from comment #3)
Patch removes quotes. Another possibility would be to escape or encode the quotes, but I'm not well versed enough with the XSLT to do so.
We could register an extension function with XML::LibXSLT, using XML::LibXSLT::register_function(), that allows us to escape or encode quotes. While I think XSLT 2.0 has a uri encoding function, XSLT 1.0 doesn't, so extension functions have to be used. I thought about adding this to the XSLT handler, but it's a global option, so we can just set it after "use XML::LibXSLT" to make the extension function available. (I wonder a bit about the repercussions while using Plack, but I don't yet know enough about Plack to really speculate on that one. I suppose it depends on the scope in which XML::LibXSLT is loaded.) -- You are receiving this mail because: You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=13812 Nick Clemens <nick@quecheelibrary.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Needs Signoff |In Discussion CC| |nick@quecheelibrary.org --- Comment #5 from Nick Clemens <nick@quecheelibrary.org> --- Is tis still valid on master? I can't recreate, could use a test plan. -- You are receiving this mail because: You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=13812 --- Comment #6 from David Cook <dcook@prosentient.com.au> --- I can't reproduce this on master either. It looks like the problem caused by: https://library.roseville.ca.us/cgi-bin/koha/opac-search.pl?q=su:%22Fairies.... is specific to either 3.16.4 or a modification that Bywater have made to that Koha instance. Here's a link that I see in the Roseville site for the query https://library.roseville.ca.us/cgi-bin/koha/opac-search.pl?q=su:%22Fairies....: <a href="/cgi-bin/koha/opac-search.pl?q=ccl=su%3A" fairies."&sort_by="relevance_asc&limit=au:Colfer%2C%20Eoin."" title="Colfer, Eoin.">Colfer, Eoin.</a> However, my query for http://192.168.1.61:2112/cgi-bin/koha/catalogue/search.pl?q=su:%22Fairies.%2... creates the following link: <a href="/cgi-bin/koha/catalogue/search.pl?q=ccl=su%3A%22Fairies.%22&sort_by=relevance_dsc&limit=itype:TEST" title="TEST">test</a> I suspect that the following line in C4::Search::buildQuery() was added after 3.16.4: $limit_cgi .= "&limit=" . uri_escape_utf8($this_limit); Although it looks like the Roseville site is also doing something with lowercasing and possibly whitespace as well... --- I suspect that the current patch might cause problems if it's used since it removes the TracingQuotesLeft and TracingQuotesRight, which are { and } with ICU, and only " and " with non-ICU. In any case, this doesn't appear to be a problem in master. -- You are receiving this mail because: You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=13812 Heather Braum <hbraum@nekls.org> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |hbraum@nekls.org -- You are receiving this mail because: You are watching all bug changes.
participants (1)
-
bugzilla-daemon@bugs.koha-community.org