Merge pull request #28185 from nextcloud/investigate/pending_size_for_s3_buckets_master

Fix folder size contained in S3 buckets
pull/28540/head
Julius Härtl 2021-08-20 15:33:02 +07:00 committed by GitHub
commit 041fbdad7a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 9 additions and 4 deletions

@ -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
*