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> (cherry picked from commit a164c51d78f375d9d660e2c079cc7e05d2d1d326) Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io> Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
This commit is contained in:
parent
32d6199b7c
commit
aec8c65336
1 changed files with 10 additions and 0 deletions
|
@ -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 a new issue