Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/updater.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMorris Jobke <hey@morrisjobke.de>2020-09-15 20:35:28 +0300
committerMorris Jobke <hey@morrisjobke.de>2020-09-15 20:35:28 +0300
commit21e2c82b76f4818ed01658c6a0fea03736f77462 (patch)
treea875456fcf3dd48ea81d704e7459830d4cf81c0d
parentbb1676232cbdfdbaee7f11b5969f82fbbab145cb (diff)
Do not depend on the order of files in a folder
Signed-off-by: Morris Jobke <hey@morrisjobke.de>
-rw-r--r--index.php6
-rw-r--r--lib/Updater.php6
2 files changed, 6 insertions, 6 deletions
diff --git a/index.php b/index.php
index 9e5526b..4ff85f4 100644
--- a/index.php
+++ b/index.php
@@ -692,14 +692,14 @@ class Updater {
$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 d0c8397..e62b79f 100644
--- a/lib/Updater.php
+++ b/lib/Updater.php
@@ -575,14 +575,14 @@ class Updater {
$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];
}
/**