From f181b71908fcdc59069b97a96ec8b36577053f8b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc=20V=C3=A9ron?= Date: Mon, 20 Mar 2017 15:56:59 +0100 Subject: [PATCH] Bug 18301: export_records.pl from the tools menu fails with the message Internal Server To reproduce: - Go to Home > Tools > Export data - Choose tab 'Export bibliographic records' or 'Export authority records' - Click 'Export (...)' Result for both: 'Internal server error' To test: - Apply patch - Try to reproduce error - Test export with and without 'Use a file' --- tools/export.pl | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/tools/export.pl b/tools/export.pl index ecf4a04..1f1eebe 100755 --- a/tools/export.pl +++ b/tools/export.pl @@ -72,11 +72,13 @@ my @branch = $query->multi_param("branch"); my @messages; if ( $op eq 'export' ) { my $filename = $query->param('id_list_file'); - my $mimetype = $query->uploadInfo($filename)->{'Content-Type'}; - my @valid_mimetypes = qw( application/octet-stream text/csv text/plain ); - unless ( grep { /^$mimetype$/ } @valid_mimetypes ) { - push @messages, { type => 'alert', code => 'invalid_mimetype' }; - $op = ''; + if ( $filename ) { + my $mimetype = $query->uploadInfo($filename)->{'Content-Type'}; + my @valid_mimetypes = qw( application/octet-stream text/csv text/plain ); + unless ( grep { /^$mimetype$/ } @valid_mimetypes ) { + push @messages, { type => 'alert', code => 'invalid_mimetype' }; + $op = ''; + } } } -- 2.1.4