mirror of
https://github.com/nextcloud/server.git
synced 2026-06-08 08:16:43 -04:00
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>
This commit is contained in:
parent
5c89061865
commit
b79b08da42
1 changed files with 9 additions and 4 deletions
|
|
@ -380,13 +380,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);
|
||||
|
|
@ -401,6 +402,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
|
||||
*
|
||||
|
|
|
|||
Loading…
Reference in a new issue