Bugzilla – Attachment 77725 Details for
Bug 20564
Error 500 displays when uploading patron images with a zipped file
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 20564: Don't use system to unzip files
Bug-20564-Dont-use-system-to-unzip-files.patch (text/plain), 1.77 KB, created by
Nick Clemens (kidclamp)
on 2018-08-11 11:32:22 UTC
(
hide
)
Description:
Bug 20564: Don't use system to unzip files
Filename:
MIME Type:
Creator:
Nick Clemens (kidclamp)
Created:
2018-08-11 11:32:22 UTC
Size:
1.77 KB
patch
obsolete
>From 809070a348ed2ac113c26c755c295b2980521be1 Mon Sep 17 00:00:00 2001 >From: Nick Clemens <nick@bywatersolutions.com> >Date: Tue, 10 Jul 2018 13:48:07 +0000 >Subject: [PATCH] Bug 20564: Don't use system to unzip files > >To test: >1 - Setup a zip file for patron images and cover images >2 - Test each tool >3 - Get a '500 error' after upload (note images do upload and attach) >4 - Apply patch >5 - Restart all the things >6 - Test agtain, uploads should complete and results display >--- > tools/picture-upload.pl | 4 +++- > tools/upload-cover-image.pl | 4 +++- > 2 files changed, 6 insertions(+), 2 deletions(-) > >diff --git a/tools/picture-upload.pl b/tools/picture-upload.pl >index 804bd96..5f99906 100755 >--- a/tools/picture-upload.pl >+++ b/tools/picture-upload.pl >@@ -115,7 +115,9 @@ if ( ( $op eq 'Upload' ) && $uploadfile ) { > } > close $tfh; > if ( $filetype eq 'zip' ) { >- unless ( system( "unzip", $tempfile, '-d', $dirname ) == 0 ) { >+ qx/unzip $tempfile -d $dirname/; >+ my $exit_code = $?; >+ unless ( $exit_code == 0 ) { > $errors{'UZIPFAIL'} = $uploadfilename; > $template->param( ERRORS => [ \%errors ] ); > # This error is fatal to the import, so bail out here >diff --git a/tools/upload-cover-image.pl b/tools/upload-cover-image.pl >index 009c890..ff89afb 100755 >--- a/tools/upload-cover-image.pl >+++ b/tools/upload-cover-image.pl >@@ -104,7 +104,9 @@ if ($fileID) { > else { > my $filename = $upload->full_path; > my $dirname = File::Temp::tempdir( CLEANUP => 1 ); >- unless ( system( "unzip", $filename, '-d', $dirname ) == 0 ) { >+ qx/unzip $filename -d $dirname/; >+ my $exit_code = $?; >+ unless ( $exit_code == 0 ) { > $error = 'UZIPFAIL'; > } > else { >-- >2.1.4
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 20564
:
76807
|
77725
|
79068
|
79072