[Bug 40569] New: Quotation marks in series fields (490/830) break search links in XSLT detail view
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=40569 Bug ID: 40569 Summary: Quotation marks in series fields (490/830) break search links in XSLT detail view Change sponsored?: --- Product: Koha Version: unspecified Hardware: All OS: All Status: NEW Severity: enhancement Priority: P5 - low Component: Staff interface Assignee: koha-bugs@lists.koha-community.org Reporter: slavashishkin@gmail.com QA Contact: testopia@bugs.koha-community.org CC: gmcharlt@gmail.com Search links generated from series fields in the XSLT detail view (MARC 440a/490a/830a) fail when the series title contains quotation marks ("), due to the lack of escaping in the generated URL. Steps to reproduce: 1. Create or edit a bibliographic record (better more than one) 2. In field 490$a or 830$a, enter a series name with quotes, e.g., Test "Series" 3. Save the record 4. On the detail page, click the Series link (generated from the XSLT view) Series: Test "Series" 5. The search fails or returns an error due to a malformed query -- You are receiving this mail because: You are the assignee for the bug. You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=40569 Slava Shishkin <slavashishkin@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |Needs Signoff -- You are receiving this mail because: You are the assignee for the bug. You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=40569 --- Comment #1 from Slava Shishkin <slavashishkin@gmail.com> --- Created attachment 184944 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=184944&action=edit Bug 40569: Escape quotation marks in series fields in XSLT search links 1. Create or edit a bibliographic record (beter more then one) 2. In field 490$a or 830$a, enter a series name with quotes, e.g. Test "Series" 3. Save the record 4. On the detail page, click the Series link (generated from the XSLT view)Series: Test "Series" 5. The search fails or returns an error due to malformed query 6. Apply the patch 7. Reload the bibliographic detail page 8. Click the Series link again 9. The search should return matching records -- You are receiving this mail because: You are the assignee for the bug. You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=40569 Bernard <bernard.scaife@openfifth.co.uk> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |bernard.scaife@openfifth.co | |.uk --- Comment #2 from Bernard <bernard.scaife@openfifth.co.uk> --- Strangely this works fine for me without any fix using test plan. 25.06.00.002 using Chrome 138.0.7204.184. Maybe different browsers are less forgiving? Rendered url that results is cgi-bin/koha/catalogue/search.pl?q=se,phr:%22Test%20%22Series%22%22 -- You are receiving this mail because: You are watching all bug changes. You are the assignee for the bug.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=40569 --- Comment #3 from Slava Shishkin <slavashishkin@gmail.com> --- Thanks, Bernard, for checking! My apologies, I forgot to mention that this only happens when SearchEngine = Elasticsearch — with Zebra, it works fine. The issue is not browser-specific. Without escaping, the generated ES query contains raw quotes: se,phr:"Test "Series"" In this case, Koha returns in the browser: No results found No results match your search for '"se,phr:"Test "Series"""'. With the patch, quotes are escaped, and the query becomes: se,phr:"Test \"Series\"" -- You are receiving this mail because: You are the assignee for the bug. You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=40569 Slava Shishkin <slavashishkin@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #184944|0 |1 is obsolete| | --- Comment #4 from Slava Shishkin <slavashishkin@gmail.com> --- Created attachment 185309 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=185309&action=edit Bug 40569: Escape quotation marks in series fields in XSLT search links (Elasticsearch) 1. Choose Elasticsearch like Search engine: cgi-bin/koha/admin/preferences.pl?op=search&searchfield=SearchEngine 2. Create or edit a bibliographic record (beter more then one) 3. In field 490$a or 830$a, enter a series name with quotes, e.g. Test "Series" 4. Save the record 5. On the detail page, click the Series link (generated from the XSLT view)Series: Test "Series" 6. The search fails or returns an error due to malformed query 7. Apply the patch 8. Reload the bibliographic detail page 9. Click the Series link again 10. The search should return matching records -- You are receiving this mail because: You are watching all bug changes. You are the assignee for the bug.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=40569 Slava Shishkin <slavashishkin@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Summary|Quotation marks in series |Quotation marks in series |fields (490/830) break |fields (490/830) break XSLT |search links in XSLT detail |search links in |view |Elasticsearch -- You are receiving this mail because: You are watching all bug changes. You are the assignee for the bug.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=40569 --- Comment #5 from Bernard <bernard.scaife@openfifth.co.uk> --- Hi Slava, I replicated it this time with elastic :) Your patch works fine! Does it also need to be on line 490 of MARC21slimUtils.xsl which also has se,phr ? Also it would be great to add to the OPAC xslt too where I think we have the same issue. /kohadevbox/koha/koha-tmpl/opac-tmpl/bootstrap/en/xslt/MARC21slimUtils.xsl lines are 381, 406, 454 and 505. thanks Bernard -- You are receiving this mail because: You are watching all bug changes. You are the assignee for the bug.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=40569 Noah <noah.tremblay@inlibro.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #185309|0 |1 is obsolete| | --- Comment #6 from Noah <noah.tremblay@inlibro.com> --- Created attachment 186245 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=186245&action=edit Hi, It works fine for me as well. I’m not changing the status since I also find Bernard’s suggestion interesting. Signed-off-by: noah <noah@inlibro.com> -- You are receiving this mail because: You are the assignee for the bug. You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=40569 Katrin Fischer <katrin.fischer@bsz-bw.de> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Needs Signoff |Failed QA Version|unspecified |Main CC| |caroline.cyr-la-rose@inlibr | |o.com Assignee|koha-bugs@lists.koha-commun |slavashishkin@gmail.com |ity.org | --- Comment #7 from Katrin Fischer <katrin.fischer@bsz-bw.de> --- 1) QA checks - all pass! 2) Code review I don't believe this is the right fix. It adds quoting, but it removed the URL encoding that I believe is also needed: - <a><xsl:attribute name="href"><xsl:value-of select="$searchurl"/>?q=se,phr:"<xsl:value-of select="str:encode-uri(marc:subfield[@code='a'], true())"/>"</xsl:attribute> + <a><xsl:attribute name="href"><xsl:value-of select="$searchurl"/>?q=se,phr:<xsl:call-template name="quote_search_term"> + <xsl:with-param name="term"><xsl:value-of select="marc:subfield[@code='a']"/></xsl:with-param> + </xsl:call-template> + </xsl:attribute> quote_search_term only adds " and escapes quotes in the string. Hope I am not missing something. 3) Other I notice that the sign-off line for Noah could be a little nicer :) Signed-off-by: noah <noah@inlibro.com> Added assignee. -- You are receiving this mail because: You are watching all bug changes. You are the assignee for the bug.
participants (1)
-
bugzilla-daemon@bugs.koha-community.org