Skip to content

Commit 6a35652

Browse files
committed
fix(AmazonS3#getMetaData): override getMetaData to read storage_mtime from stat
Signed-off-by: Maksim Sukharev <antreesy.web@gmail.com>
1 parent 4041a10 commit 6a35652

1 file changed

Lines changed: 16 additions & 0 deletions

File tree

apps/files_external/lib/Lib/Storage/AmazonS3.php

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -320,6 +320,22 @@ public function stat(string $path): array|false {
320320
return $stat;
321321
}
322322

323+
public function getMetaData(string $path): ?array {
324+
$data = parent::getMetaData($path);
325+
if ($data !== null && $data['mimetype'] === FileInfo::MIMETYPE_FOLDER) {
326+
// Common::getMetaData sets storage_mtime = mtime, but for S3 virtual directories
327+
// mtime may have been updated by mtime propagation while storage_mtime should
328+
// reflect the actual last storage change. Without this override the scanner sees
329+
// data['storage_mtime'] != cacheData['storage_mtime'] and re-writes the cache,
330+
// causing View::getCacheEntry to trigger propagateChange on every read.
331+
$stat = $this->stat($path);
332+
if (isset($stat['storage_mtime'])) {
333+
$data['storage_mtime'] = $stat['storage_mtime'];
334+
}
335+
}
336+
return $data;
337+
}
338+
323339
public function is_dir(string $path): bool {
324340
$path = $this->normalizePath($path);
325341

0 commit comments

Comments
 (0)