Bug 40989: Fix OAI-PMH tests for CGI.pm 4.68+
CGI.pm 4.68 (shipped with Debian 13/Trixie) changed the behavior of self_url() to include a trailing slash when there's no path component. This causes OAI-PMH tests to fail as they expect URLs without trailing slashes. This patch strips the trailing slash from both the requestURL field in OAI responses and the baseURL field in Identify responses to maintain compatibility across CGI.pm versions. Test plan: 1. Start a 'trixie' KTD: $ KOHA_IMAGE=main-trixie ktd --proxy --name trixie up -d $ ktd --name trixie --wait-ready 120 2. Run the tests: $ ktd --name trixie --shell k$ prove t/db_dependent/OAI/Server.t => FAIL: Tests fail! 3. Apply this patch 5. Repeat 2 6. Repeat 1-2 with a 'bookworm' image => SUCCESS: Tests pass too! 7. Sign off :-D Signed-off-by: David Nind <david@davidnind.com> Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net> Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
This commit is contained in:
parent
c597046a9e
commit
2224de5a5a
|
|
@ -33,6 +33,7 @@ sub new {
|
|||
my $baseURL = $repository->self_url();
|
||||
$baseURL = $+{base_url}
|
||||
if $baseURL =~ m/(?<base_url>.*)\?.*/;
|
||||
$baseURL =~ s{/$}{}; # Strip trailing slash for CGI.pm 4.68+ compatibility
|
||||
|
||||
my $self = $class->SUPER::new(
|
||||
baseURL => $baseURL,
|
||||
|
|
|
|||
|
|
@ -157,6 +157,11 @@ sub new {
|
|||
$response = $class->new( $self, %attr );
|
||||
}
|
||||
|
||||
# Strip trailing slash from requestURL for CGI.pm 4.68+ compatibility
|
||||
my $url = $response->requestURL();
|
||||
$url =~ s{/$}{};
|
||||
$response->requestURL($url);
|
||||
|
||||
$response->set_handler( XML::SAX::Writer->new( Output => *STDOUT ) );
|
||||
$response->xslt("/opac-tmpl/xslt/OAI.xslt");
|
||||
$response->generate;
|
||||
|
|
|
|||
Loading…
Reference in New Issue