Bug 5087: Add server-side check
If a user to access a CSV profile that is not available at the OPAC we should redirect to 404. It will also handle undefined csv_profiles For instance: kohadev.mydnsname.org:8080/cgi-bin/koha/opac-downloadshelf.pl?shelfnumber=1&format=3 kohadev.mydnsname.org:8080/cgi-bin/koha/opac-downloadcart.pl?bib_list=1/2/&format=3 Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
This commit is contained in:
parent
db15f4af8d
commit
c2d45ac0f4
|
|
@ -66,6 +66,12 @@ if ($bib_list && $format) {
|
|||
# CSV
|
||||
if ($format =~ /^\d+$/) {
|
||||
|
||||
my $csv_profile = Koha::CsvProfiles->find($format);
|
||||
if ( not $csv_profile or $csv_profile->staff_only ) {
|
||||
print $query->redirect('/cgi-bin/koha/errors/404.pl');
|
||||
exit;
|
||||
}
|
||||
|
||||
$output = marc2csv(\@bibs, $format);
|
||||
|
||||
# Other formats
|
||||
|
|
|
|||
|
|
@ -75,6 +75,13 @@ if ( $shelf and $shelf->can_be_viewed( $borrowernumber ) ) {
|
|||
|
||||
# CSV
|
||||
if ($format =~ /^\d+$/) {
|
||||
|
||||
my $csv_profile = Koha::CsvProfiles->find($format);
|
||||
if ( not $csv_profile or $csv_profile->staff_only ) {
|
||||
print $query->redirect('/cgi-bin/koha/errors/404.pl');
|
||||
exit;
|
||||
}
|
||||
|
||||
my @biblios;
|
||||
while ( my $content = $contents->next ) {
|
||||
push @biblios, $content->biblionumber;
|
||||
|
|
|
|||
Loading…
Reference in New Issue