aboutsummaryrefslogtreecommitdiffstats
path: root/apps/files_versions
diff options
context:
space:
mode:
authorMorris Jobke <hey@morrisjobke.de>2020-10-13 17:35:35 +0200
committerGitHub <noreply@github.com>2020-10-13 17:35:35 +0200
commitf8ed08ca2aeedf87161f1acb2d905053a77664a4 (patch)
treea26f6fe01bfdd759f35ba0829a9a026ac621f6c9 /apps/files_versions
parent5111d6a3e279746aa7a63bf3fd644bac714120b5 (diff)
parent6ce05bc7d78306bbe06ab2ee47c4e0e0ae0e354c (diff)
downloadnextcloud-server-f8ed08ca2aeedf87161f1acb2d905053a77664a4.tar.gz
nextcloud-server-f8ed08ca2aeedf87161f1acb2d905053a77664a4.zip
Merge pull request #23295 from nextcloud/fix/versions-no-space-no-versions-undefined-index
Fix undefined index and consequential damages in versions code
Diffstat (limited to 'apps/files_versions')
-rw-r--r--apps/files_versions/lib/Storage.php9
1 files changed, 6 insertions, 3 deletions
diff --git a/apps/files_versions/lib/Storage.php b/apps/files_versions/lib/Storage.php
index 3f4ccf7f0a2..147edeb6726 100644
--- a/apps/files_versions/lib/Storage.php
+++ b/apps/files_versions/lib/Storage.php
@@ -496,7 +496,7 @@ class Storage {
$expiration = self::getExpiration();
$threshold = $expiration->getMaxAgeAsTimestamp();
$versions = self::getAllVersions($uid);
- if (!$threshold || !array_key_exists('all', $versions)) {
+ if (!$threshold || empty($versions['all'])) {
return;
}
@@ -578,7 +578,10 @@ class Storage {
// newest version first
krsort($versions);
- $result = [];
+ $result = [
+ 'all' => [],
+ 'by_file' => [],
+ ];
foreach ($versions as $key => $value) {
$size = $view->filesize(self::VERSIONS_ROOT.'/'.$value['path'].'.v'.$value['timestamp']);
@@ -775,7 +778,7 @@ class Storage {
// if still not enough free space we rearrange the versions from all files
if ($availableSpace <= 0) {
- $result = Storage::getAllVersions($uid);
+ $result = self::getAllVersions($uid);
$allVersions = $result['all'];
foreach ($result['by_file'] as $versions) {