From 9077d5a172149c92485bb3b89778c6493a7d8f44 Mon Sep 17 00:00:00 2001 From: Marcel de Rooy Date: Tue, 20 Dec 2016 16:11:36 +0100 Subject: [PATCH] Bug 17785: Fix OAI-PMH's XSLT-generated URLs under Plack 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. Edit: changed commit subject Signed-off-by: Tomas Cohen Arazi Works as expected. Good workaround until a definitive solution is implemented. Signed-off-by: Jonathan Druart Signed-off-by: Mason James --- 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 976f0c2fa7..d9facccbe3 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 @@