From e7061721b4d9b5f4d538062b82012e88182c2812 Mon Sep 17 00:00:00 2001 From: Pedro Amorim Date: Mon, 20 Oct 2025 15:44:42 +0000 Subject: [PATCH] [24.11] Bug 41057: Return 404 if creating backend is not an OPAC backend --- opac/opac-illrequests.pl | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/opac/opac-illrequests.pl b/opac/opac-illrequests.pl index a4cf46b8125..349bb882da3 100755 --- a/opac/opac-illrequests.pl +++ b/opac/opac-illrequests.pl @@ -43,7 +43,11 @@ my $query = CGI->new; our $params = $query->Vars(); # if illrequests is disabled, leave immediately -if ( ! C4::Context->preference('ILLModule') ) { +my $reduced = C4::Context->preference('ILLOpacbackends'); +my $backends = Koha::ILL::Request::Config->new->available_backends( $reduced ); +if ( ! C4::Context->preference('ILLModule') + || ( $params->{backend} && !grep { $_ eq $params->{backend} } @$backends ) ) +{ print $query->redirect("/cgi-bin/koha/errors/404.pl"); exit; } @@ -55,8 +59,6 @@ my ( $template, $loggedinuser, $cookie ) = get_template_and_user({ }); # Are we able to actually work? -my $reduced = C4::Context->preference('ILLOpacbackends'); -my $backends = Koha::ILL::Request::Config->new->available_backends($reduced); my $backends_available = ( scalar @{$backends} > 0 ); $template->param( backends_available => $backends_available ); my $patron = Koha::Patrons->find($loggedinuser); -- 2.39.5