Bug 37370: Return 400 if OpacExportOptions does not contain the passed format
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io> Signed-off-by: David Cook <dcook@prosentient.com.au> Signed-off-by: Nick Clemens <nick@bywatersolutions.com> Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
This commit is contained in:
parent
87e47855e2
commit
5514a673e8
|
|
@ -33,6 +33,8 @@ use C4::Ris qw( marc2ris );
|
|||
use Koha::Biblios;
|
||||
use Koha::RecordProcessor;
|
||||
|
||||
use List::MoreUtils qw(none);
|
||||
|
||||
my $query = CGI->new;
|
||||
my $op=$query->param("op")||''; #op=export is currently the only use
|
||||
my $format=$query->param("format")||'utf8';
|
||||
|
|
@ -40,6 +42,14 @@ my $biblionumber = $query->param("bib")||0;
|
|||
$biblionumber = int($biblionumber);
|
||||
my $error = q{};
|
||||
|
||||
my @valid_formats = split( ',', C4::Context->preference('OpacExportOptions') // '' );
|
||||
if ( !scalar @valid_formats || none { $format eq $_ } @valid_formats ) {
|
||||
# bad request: either the feature is disabled, or requested a format the
|
||||
# library hasn't made available
|
||||
print $query->redirect("/cgi-bin/koha/errors/400.pl");
|
||||
exit;
|
||||
}
|
||||
|
||||
# Determine logged in user's patron category.
|
||||
# Blank if not logged in.
|
||||
my $userenv = C4::Context->userenv;
|
||||
|
|
|
|||
Loading…
Reference in New Issue