From 19e6bf643e912171a19481c71081c988451ad5fb Mon Sep 17 00:00:00 2001 From: Marcel de Rooy Date: Tue, 20 Dec 2016 16:11:36 +0100 Subject: [PATCH] Bug 17785: oai.pl returns wrong URLs under Plack Content-Type: text/plain; charset=utf-8 Look at e.g. the URL for Show More at the end of the output of Records or Identifiers. If you use Plack, you will see that it refers to yourserver:/opac/oai.pl, which is not correct. This is caused by using CGI's self_url in combination with script alias, mounting point, etc. Note that we cannot solve this problem in the code of Koha only. Since HTTP::OAI modules also call self_url, we still end up with some wrong url's. Instead of a larger architectural operation on Apache and Plack config files, this patch adjusts the final xslt transformation on the OAI response. It hardcodes the correct path only once, in a xslt variable. And replaces all oai:OAI-PMH/oai:request/text() calls, containing wrong URLs, by this variable. Test plan: Run oai.pl. Try the various verbs. Verify that the URLs point to /cgi-bin/koha/oai.pl. --- koha-tmpl/opac-tmpl/xslt/OAI.xslt | 28 +++++++++++++++------------- 1 file changed, 15 insertions(+), 13 deletions(-) diff --git a/koha-tmpl/opac-tmpl/xslt/OAI.xslt b/koha-tmpl/opac-tmpl/xslt/OAI.xslt index 976f0c2..d9faccc 100644 --- a/koha-tmpl/opac-tmpl/xslt/OAI.xslt +++ b/koha-tmpl/opac-tmpl/xslt/OAI.xslt @@ -18,6 +18,8 @@ + /cgi-bin/koha/oai.pl + @@ -44,7 +46,7 @@ + select="concat($oai_script_name,'?verb=Identify')"> Identify @@ -56,7 +58,7 @@ + select="concat($oai_script_name, '?verb=ListSets')"> Sets @@ -68,7 +70,7 @@ + select="concat($oai_script_name, '?verb=ListRecords&metadataPrefix=oai_dc')"> Records @@ -80,7 +82,7 @@ + select="concat($oai_script_name, '?verb=ListIdentifiers&metadataPrefix=oai_dc')"> Identifiers @@ -93,7 +95,7 @@ + select="concat($oai_script_name, '?verb=ListMetadataFormats')"> Metadata Formats @@ -238,14 +240,14 @@ + select="concat($oai_script_name, '?verb=ListRecords&metadataPrefix=oai_dc&set=', oai:setSpec/text())" /> Records + select="concat($oai_script_name, '?verb=ListIdentifiers&metadataPrefix=oai_dc&set=', oai:setSpec/text())" /> Identifiers @@ -303,7 +305,7 @@ + select="concat($oai_script_name, '?verb=ListRecords&metadataPrefix=oai_dc&set=', text())" /> @@ -367,7 +369,7 @@ + select="concat($oai_script_name, '?verb=ListRecords&metadataPrefix=oai_dc&set=', text())" /> @@ -415,7 +417,7 @@