Skip to content

Commit 2fcfd53

Browse files
icewind1991susnux
authored andcommitted
fix: handle case where we can't get the filesize after open in dav get
Signed-off-by: Robin Appelman <robin@icewind.nl>
1 parent c70d5a4 commit 2fcfd53

1 file changed

Lines changed: 4 additions & 2 deletions

File tree

apps/dav/lib/Connector/Sabre/File.php

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -473,11 +473,13 @@ public function get() {
473473
}
474474
}
475475

476+
$logger = Server::get(LoggerInterface::class);
476477
// comparing current file size with the one in DB
477478
// if different, fix DB and refresh cache.
478479
$fsSize = $this->fileView->filesize($this->getPath());
479-
if ($this->getSize() !== $fsSize) {
480-
$logger = Server::get(LoggerInterface::class);
480+
if ($fsSize === false) {
481+
$logger->warning('file not found on storage after successfully opening it');
482+
} elseif ($this->getSize() !== $fsSize) {
481483
$logger->warning('fixing cached size of file id=' . $this->getId() . ', cached size was ' . $this->getSize() . ', but the filesystem reported a size of ' . $fsSize);
482484

483485
$this->getFileInfo()->getStorage()->getUpdater()->update($this->getFileInfo()->getInternalPath());

0 commit comments

Comments
 (0)