Check whether an app archive can be extracted

If extraction fails we should not continue the installation/update
process as the info.xml cannot be loaded and an unrelated error
occurs.

Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
This commit is contained in:
Christoph Wurst 2017-09-20 14:07:17 +02:00
parent e43400eddb
commit 2e19c42bc5
No known key found for this signature in database
GPG Key ID: CC42AC2A7F0E56D8
1 changed files with 8 additions and 1 deletions

View File

@ -288,7 +288,14 @@ class Installer {
$archive = new TAR($tempFile);
if($archive) {
$archive->extract($extractDir);
if (!$archive->extract($extractDir)) {
throw new \Exception(
sprintf(
'Could not extract app %s',
$appId
)
);
}
$allFiles = scandir($extractDir);
$folders = array_diff($allFiles, ['.', '..']);
$folders = array_values($folders);