diff options
author | Louis Chemineau <louis@chmn.me> | 2021-08-19 12:28:10 +0200 |
---|---|---|
committer | Louis Chemineau <louis@chmn.me> | 2021-08-19 15:03:46 +0200 |
commit | 735fd94cc05ae651eea0d9d62bb7afc3b360033f (patch) | |
tree | 341e68f0791103cea639d4738139126c3875b0e2 /apps/files_external | |
parent | 6752388c69e48ec1de7b00e54302470b0693f605 (diff) | |
download | nextcloud-server-735fd94cc05ae651eea0d9d62bb7afc3b360033f.tar.gz nextcloud-server-735fd94cc05ae651eea0d9d62bb7afc3b360033f.zip |
Fix folder size contained in S3 buckets
If 'filesystem_check_changes' was set to never, the cached size was alway set to -1 (Pending) on every access
Signed-off-by: Louis Chemineau <louis@chmn.me>
Diffstat (limited to 'apps/files_external')
-rw-r--r-- | apps/files_external/lib/Lib/Storage/AmazonS3.php | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/apps/files_external/lib/Lib/Storage/AmazonS3.php b/apps/files_external/lib/Lib/Storage/AmazonS3.php index 9f121cc880a..1bdd11e39bd 100644 --- a/apps/files_external/lib/Lib/Storage/AmazonS3.php +++ b/apps/files_external/lib/Lib/Storage/AmazonS3.php @@ -385,13 +385,14 @@ class AmazonS3 extends \OC\Files\Storage\Common { try { $stat = []; if ($this->is_dir($path)) { - //folders don't really exist - $stat['size'] = -1; //unknown - $stat['mtime'] = time(); $cacheEntry = $this->getCache()->get($path); - if ($cacheEntry instanceof CacheEntry && $this->getMountOption('filesystem_check_changes', 1) !== 1) { + if ($cacheEntry instanceof CacheEntry) { $stat['size'] = $cacheEntry->getSize(); $stat['mtime'] = $cacheEntry->getMTime(); + } else { + // Use dummy values + $stat['size'] = -1; // Pending + $stat['mtime'] = time(); } } else { $stat['size'] = $this->getContentLength($path); @@ -406,6 +407,10 @@ class AmazonS3 extends \OC\Files\Storage\Common { } } + public function hasUpdated($path, $time) { + return $this->getMountOption('filesystem_check_changes', 1) === 1 || parent::hasUpdated($path, $time); + } + /** * Return content length for object * |