Bug 16800: Fix XSS in catalogue/*detail.tt - title
[koha.git] / virtualshelves / downloadshelf.pl
index 3db362a..d988161 100755 (executable)
@@ -28,7 +28,6 @@ use C4::Items;
 use C4::Output;
 use C4::Record;
 use C4::Ris;
-use C4::Csv;
 
 use Koha::CsvProfiles;
 use Koha::Virtualshelves;
@@ -84,6 +83,10 @@ if ($shelfid && $format) {
                     }
                 }
             }
+
+            # If it was a CSV export we change the format after the export so the file extension is fine
+            $format = "csv" if ($format =~ m/^\d+$/);
+
             print $query->header(
             -type => 'application/octet-stream',
             -'Content-Transfer-Encoding' => 'binary',
@@ -96,9 +99,6 @@ if ($shelfid && $format) {
     } else {
         push @messages, { type => 'error', code => 'does_not_exist' };
     }
-
-    # If it was a CSV export we change the format after the export so the file extension is fine
-    $format = "csv" if ($format =~ m/^\d+$/);
 }
 else {
     $template->param(csv_profiles => [ Koha::CsvProfiles->search({ type => 'marc' }) ]);