Skip to content
Open
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
7 changes: 5 additions & 2 deletions apps/dav/lib/Connector/Sabre/File.php
Original file line number Diff line number Diff line change
Expand Up @@ -480,11 +480,14 @@ public function get() {
}
}

$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');
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does it make sense (for proper client error code) to throw a StorageNotAvailableException here?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Given that the file opened successfully, I'm not sure if we should return an error or just try to read the handle we got an hope that that gives the correct content.

We don't really have enough info to determine that.

} 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());
Expand Down
Loading