From f215161183d39fb415070704b45dffd252c20062 Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Tue, 22 Apr 2014 17:05:45 +0200 Subject: [PATCH] Bug 5771: Set the directory path to /tmp The report filename should be written into /tmp --- tools/import_borrowers.pl | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/tools/import_borrowers.pl b/tools/import_borrowers.pl index 8aabe4e..97d63ea 100755 --- a/tools/import_borrowers.pl +++ b/tools/import_borrowers.pl @@ -58,6 +58,8 @@ use Text::CSV; use CGI; # use encoding 'utf8'; # don't do this +my $tmpdir = '/tmp'; + my (@errors, @feedback); my $extended = C4::Context->preference('ExtendedPatronAttributes'); my $set_messaging_prefs = C4::Context->preference('EnhancedMessagingPreferences'); @@ -96,7 +98,9 @@ if ($input->param('report')) { -type => 'text/plain', -attachment => 'import_borrowers_report.txt' ); - open my $fh, '<', $input->param('errors_filename'); + my $filename = $input->param('errors_filename'); + $filename =~ s/\.\.//g; + open my $fh, '<', $tmpdir . '/' . $filename; print $fh; close $fh; #TODO : We surely want to check that is it really a temp file that we are unlinking @@ -366,7 +370,8 @@ if ( $uploadborrowers && length($uploadborrowers) > 0 ) { print $tmpf $output; $template->param( download_errors => 1, - errors_filename => $tmpf->filename + errors_filename => $tmpf->filename, + DIR => $tmpdir, ); close $tmpf; } -- 1.7.10.4