diff --git a/index.php b/index.php index 5ce9d5b9..74bd1236 100644 --- a/index.php +++ b/index.php @@ -692,14 +692,14 @@ private function getDownloadedFilePath() { $this->silentLog('[info] storage location: ' . $storageLocation); $filesInStorageLocation = scandir($storageLocation); - $files = array_filter($filesInStorageLocation, function($path){ + $files = array_values(array_filter($filesInStorageLocation, function($path){ return $path !== '.' && $path !== '..'; - }); + })); // only the downloaded archive if(count($files) !== 1) { throw new \Exception('There are more files than the downloaded archive in the downloads/ folder.'); } - return $storageLocation . '/' . $files[2]; + return $storageLocation . '/' . $files[0]; } /** diff --git a/lib/Updater.php b/lib/Updater.php index 7625688b..8faadc66 100644 --- a/lib/Updater.php +++ b/lib/Updater.php @@ -575,14 +575,14 @@ private function getDownloadedFilePath() { $this->silentLog('[info] storage location: ' . $storageLocation); $filesInStorageLocation = scandir($storageLocation); - $files = array_filter($filesInStorageLocation, function($path){ + $files = array_values(array_filter($filesInStorageLocation, function($path){ return $path !== '.' && $path !== '..'; - }); + })); // only the downloaded archive if(count($files) !== 1) { throw new \Exception('There are more files than the downloaded archive in the downloads/ folder.'); } - return $storageLocation . '/' . $files[2]; + return $storageLocation . '/' . $files[0]; } /**