Bugzilla – Attachment 43412 Details for
Bug 14716
Correctly URI-encode URLs in XSLT result lists and detail pages
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 14716 - opac-detail.pl -- Series link fails when series title ends with semicolon preceded by space.
Bug-14716---opac-detailpl----Series-link-fails-whe.patch (text/plain), 5.92 KB, created by
Mason James
on 2015-10-15 00:28:36 UTC
(
hide
)
Description:
Bug 14716 - opac-detail.pl -- Series link fails when series title ends with semicolon preceded by space.
Filename:
MIME Type:
Creator:
Mason James
Created:
2015-10-15 00:28:36 UTC
Size:
5.92 KB
patch
obsolete
>From 382273acee1d29b89122c1c89c85b1fb13a46fe8 Mon Sep 17 00:00:00 2001 >From: Kyle M Hall <kyle@bywatersolutions.com> >Date: Tue, 13 Oct 2015 11:31:44 -0400 >Subject: [PATCH] Bug 14716 - opac-detail.pl -- Series link fails when series > title ends with semicolon preceded by space. >Content-Type: text/plain; charset="utf-8" > >This is happening because the query is malformed. > >Take for example the query se,phr:"Frank%20Einstein%20;" which is > >se,phr:"Frank Einstein" > >but the semicolon is truncating the query so it looks to Koha > >se,phr:"Frank Einstein > >which is not a problem on the staff side. Zebra seems to deal with this >ok. > >On the opac side though, we are adding on supression, so the query ends >up like this: > >(se,phr:"Frank Einstein ) not Suppress=1 > >which zebra chokes on. > >Removing the semicolon from the subject heading would fix this, but I >imagine that's a band-aid as the semi is part of the standard. > >The semi is being treated as an ampersand. This is deep in the machinery >( http://www.w3.org/TR/1999/REC-html401-19991224/appendix/notes.html#h-B.2.2 ) > >Basically, the semi needs to be url encoded as %3B > >Test Plan: >1) Import the records in the attached MARC21 file, re-index >2) From the OPAC search for "Frank Einstein and the antimatter motor" >3) Click the series link, note you get no results >4) Apply this patch >5) Refresh the record details page >6) Click the series link >7) Results! > >NOTE: This bug does not occurr with all Koha server configurations. > I have yet to determine the specific variable that creates > this truncation behavior. > >Signed-off-by: Mason James <mtj@kohaaloha.com> >--- > .../bootstrap/en/xslt/MARC21slim2OPACDetail.xsl | 2 +- > .../bootstrap/en/xslt/MARC21slimUtils.xsl | 43 ++++++++++++++++++++++ > 2 files changed, 44 insertions(+), 1 deletion(-) > >diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/xslt/MARC21slim2OPACDetail.xsl b/koha-tmpl/opac-tmpl/bootstrap/en/xslt/MARC21slim2OPACDetail.xsl >index dcfc521..15f0e8c 100644 >--- a/koha-tmpl/opac-tmpl/bootstrap/en/xslt/MARC21slim2OPACDetail.xsl >+++ b/koha-tmpl/opac-tmpl/bootstrap/en/xslt/MARC21slim2OPACDetail.xsl >@@ -218,7 +218,7 @@ > > <!-- 490 Series not traced, Ind1 = 0 --> > <xsl:for-each select="marc:datafield[@tag=490][@ind1!=1]"> >- <a><xsl:attribute name="href">/cgi-bin/koha/opac-search.pl?q=se,phr:"<xsl:value-of select="marc:subfield[@code='a']"/>"</xsl:attribute> >+ <a><xsl:attribute name="href">/cgi-bin/koha/opac-search.pl?q=se,phr:"<xsl:call-template name="url-encode"><xsl:with-param name="str" select="marc:subfield[@code='a']"/></xsl:call-template>"</xsl:attribute> > <xsl:call-template name="chopPunctuation"> > <xsl:with-param name="chopString"> > <xsl:call-template name="subfieldSelect"> >diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/xslt/MARC21slimUtils.xsl b/koha-tmpl/opac-tmpl/bootstrap/en/xslt/MARC21slimUtils.xsl >index 4f7efed..a00d73e 100644 >--- a/koha-tmpl/opac-tmpl/bootstrap/en/xslt/MARC21slimUtils.xsl >+++ b/koha-tmpl/opac-tmpl/bootstrap/en/xslt/MARC21slimUtils.xsl >@@ -271,6 +271,49 @@ > <xsl:value-of select="$field/marc:subfield[@code='c']"/> > </xsl:template> > >+ <xsl:variable name="ascii"> !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~</xsl:variable> >+ <xsl:variable name="latin1"> ¡¢£¤¥¦§¨©ª«¬­®¯°±²³´µ¶·¸¹º»¼½¾¿ÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖ×ØÙÚÛÜÝÞßàáâãäåæçèéêëìíîïðñòóôõö÷øùúûüýþÿ</xsl:variable> >+ >+ <!-- Characters that usually don't need to be escaped --> >+ <xsl:variable name="safe">!'()*-.0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ_abcdefghijklmnopqrstuvwxyz~</xsl:variable> >+ >+ <xsl:variable name="hex" >0123456789ABCDEF</xsl:variable> >+ <xsl:template name="url-encode"> >+ <xsl:param name="str"/> >+ <xsl:if test="$str"> >+ <xsl:variable name="first-char" select="substring($str,1,1)"/> >+ <xsl:choose> >+ <xsl:when test="contains($safe,$first-char)"> >+ <xsl:value-of select="$first-char"/> >+ </xsl:when> >+ <xsl:otherwise> >+ <xsl:variable name="codepoint"> >+ <xsl:choose> >+ <xsl:when test="contains($ascii,$first-char)"> >+ <xsl:value-of select="string-length(substring-before($ascii,$first-char)) + 32"/> >+ </xsl:when> >+ <xsl:when test="contains($latin1,$first-char)"> >+ <xsl:value-of select="string-length(substring-before($latin1,$first-char)) + 160"/> >+ </xsl:when> >+ <xsl:otherwise> >+ <xsl:message terminate="no">Warning: string contains a character that is out of range! Substituting "?".</xsl:message> >+ <xsl:text>63</xsl:text> >+ </xsl:otherwise> >+ </xsl:choose> >+ </xsl:variable> >+ <xsl:variable name="hex-digit1" select="substring($hex,floor($codepoint div 16) + 1,1)"/> >+ <xsl:variable name="hex-digit2" select="substring($hex,$codepoint mod 16 + 1,1)"/> >+ <xsl:value-of select="concat('%',$hex-digit1,$hex-digit2)"/> >+ </xsl:otherwise> >+ </xsl:choose> >+ <xsl:if test="string-length($str) > 1"> >+ <xsl:call-template name="url-encode"> >+ <xsl:with-param name="str" select="substring($str,2)"/> >+ </xsl:call-template> >+ </xsl:if> >+ </xsl:if> >+ </xsl:template> >+ > </xsl:stylesheet> > > <!-- Stylus Studio meta-information - (c)1998-2002 eXcelon Corp. >-- >2.1.4
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 14716
:
41870
|
43385
|
43386
|
43412
|
43413
|
44174
|
44175
|
45743
|
72089
|
73598
|
73605
|
74226
|
74227
|
74228
|
74804
|
76425
|
77471
|
78809
|
80701
|
81052
|
81053
|
81054
|
81305
|
81520
|
81521
|
81522
|
81523