Added handling for empty archives

This commit is contained in:
Matthew Barbour 2020-06-24 09:17:44 -05:00 committed by Shish
parent 7a009541ce
commit 9e1aabe17f

View file

@ -29,12 +29,17 @@ class ArchiveFileHandler extends DataHandlerExtension
$cmd = str_replace('%f', $event->tmpname, $cmd); $cmd = str_replace('%f', $event->tmpname, $cmd);
$cmd = str_replace('%d', $tmpdir, $cmd); $cmd = str_replace('%d', $tmpdir, $cmd);
exec($cmd); exec($cmd);
$results = add_dir($tmpdir); if(file_exists($tmpdir)) {
if (count($results) > 0) { try {
$page->flash("Adding files" . implode("\n", $results)); $results = add_dir($tmpdir);
if (count($results) > 0) {
$page->flash("Adding files" . implode("\n", $results));
}
} finally {
deltree($tmpdir);
}
$event->image_id = -2; // default -1 = upload wasn't handled
} }
deltree($tmpdir);
$event->image_id = -2; // default -1 = upload wasn't handled
} }
} }