fix: handle case where we can't get the filesize after open in dav get

Signed-off-by: Robin Appelman <robin@icewind.nl>
This commit is contained in:
Robin Appelman
2026-02-24 16:33:34 +01:00
committed by Ferdinand Thiessen
parent c70d5a4967
commit 2fcfd53e0b

View File

@@ -473,11 +473,13 @@ class File extends Node implements IFile {
}
}
$logger = Server::get(LoggerInterface::class);
// comparing current file size with the one in DB
// if different, fix DB and refresh cache.
$fsSize = $this->fileView->filesize($this->getPath());
if ($this->getSize() !== $fsSize) {
$logger = Server::get(LoggerInterface::class);
if ($fsSize === false) {
$logger->warning('file not found on storage after successfully opening it');
} elseif ($this->getSize() !== $fsSize) {
$logger->warning('fixing cached size of file id=' . $this->getId() . ', cached size was ' . $this->getSize() . ', but the filesystem reported a size of ' . $fsSize);
$this->getFileInfo()->getStorage()->getUpdater()->update($this->getFileInfo()->getInternalPath());