Bug 42175: Fix Mojo under k.t.d

This patch fixes Mojo under k.t.d by providing CGI::Compile with an
absolute rather than relative path.

TO TEST:
== APPLY PATCH ==
a)  run reset_all
b)  run apachectl stop (if apache does not stop, may need to `sudo kill -9 apache2`)
c)  run /kohadevbox/koha/bin/opac prefork -m production -p -l http://*:8080 &
c)  run /kohadevbox/koha/bin/intranet prefork -m production -p -l http://*:8081 &
d)  confirm you can use k.t.d. as normal
== SIGN OFF ==

Signed-off-by: Eric Phetteplace <ephetteplace@cca.edu>
Signed-off-by: David Cook <dcook@prosentient.com.au>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
This commit is contained in:
Jake Deery 2026-03-25 14:24:30 +00:00 committed by Lucas Gass
parent 1b1c23bc07
commit 5187bd52b9
No known key found for this signature in database
GPG Key ID: 60B447398B0D36CA
1 changed files with 4 additions and 3 deletions

View File

@ -80,9 +80,10 @@ sub _render_script {
return $c->reply->not_found;
}
my $sub = CGI::Compile->compile($script);
my $app = CGI::Emulate::PSGI->handler($sub);
my $response = $app->( $c->_psgi_env() );
my $abs_script = $c->app->home->rel_file($script);
my $sub = CGI::Compile->compile($abs_script);
my $app = CGI::Emulate::PSGI->handler($sub);
my $response = $app->( $c->_psgi_env() );
$c->res->code( $response->[0] );
$c->res->headers->from_hash( { @{ $response->[1] } } );