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

github.com/nextcloud/server.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/apps
diff options
context:
space:
mode:
authorLouis Chemineau <louis@chmn.me>2021-08-19 13:28:10 +0300
committerbackportbot[bot] <backportbot[bot]@users.noreply.github.com>2021-08-20 16:35:22 +0300
commit951aa784b071151cc92f6918f357d79bb50f75ad (patch)
treed3aeade929d292b3f7383b7c2a87fa6ef69a3572 /apps
parent8be50456e5938f8b7c478adafc0f06c674cff9f3 (diff)
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')
-rw-r--r--apps/files_external/lib/Lib/Storage/AmazonS3.php13
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 32e74250a91..220822f9396 100644
--- a/apps/files_external/lib/Lib/Storage/AmazonS3.php
+++ b/apps/files_external/lib/Lib/Storage/AmazonS3.php
@@ -384,13 +384,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);
@@ -405,6 +406,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
*