Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[stable21] Fix folder size contained in S3 buckets #28535

Merged
merged 1 commit into from
Aug 23, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 9 additions & 4 deletions apps/files_external/lib/Lib/Storage/AmazonS3.php
Original file line number Diff line number Diff line change
Expand Up @@ -380,13 +380,14 @@ public function stat($path) {
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);
Expand All @@ -401,6 +402,10 @@ public function stat($path) {
}
}

public function hasUpdated($path, $time) {
return $this->getMountOption('filesystem_check_changes', 1) === 1 || parent::hasUpdated($path, $time);
}

/**
* Return content length for object
*
Expand Down