|
|
|
@ -45,11 +45,11 @@ use OC\Files\Stream\HashWrapper;
|
|
|
|
|
use OC\Files\View;
|
|
|
|
|
use OC\Metadata\FileMetadata;
|
|
|
|
|
use OCA\DAV\AppInfo\Application;
|
|
|
|
|
use OCA\DAV\Connector\Sabre\Exception\BadGateway;
|
|
|
|
|
use OCA\DAV\Connector\Sabre\Exception\EntityTooLarge;
|
|
|
|
|
use OCA\DAV\Connector\Sabre\Exception\FileLocked;
|
|
|
|
|
use OCA\DAV\Connector\Sabre\Exception\Forbidden as DAVForbiddenException;
|
|
|
|
|
use OCA\DAV\Connector\Sabre\Exception\UnsupportedMediaType;
|
|
|
|
|
use OCA\DAV\Connector\Sabre\Exception\BadGateway;
|
|
|
|
|
use OCP\Encryption\Exceptions\GenericEncryptionException;
|
|
|
|
|
use OCP\Files\EntityTooLargeException;
|
|
|
|
|
use OCP\Files\FileInfo;
|
|
|
|
@ -492,9 +492,21 @@ class File extends Node implements IFile {
|
|
|
|
|
} catch (\Exception $e) {
|
|
|
|
|
$this->convertToSabreException($e);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if ($res === false) {
|
|
|
|
|
throw new ServiceUnavailable($this->l10n->t('Could not open file'));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// comparing current file size with the one in DB
|
|
|
|
|
// if different, fix DB and refresh cache.
|
|
|
|
|
if ($this->getSize() !== $this->fileView->filesize($this->getPath())) {
|
|
|
|
|
$logger = \OC::$server->get(ILogger::class);
|
|
|
|
|
$logger->warning('fixing cached size of file id=' . $this->getId());
|
|
|
|
|
|
|
|
|
|
$this->getFileInfo()->getStorage()->getUpdater()->update($this->getFileInfo()->getInternalPath());
|
|
|
|
|
$this->refreshInfo();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return $res;
|
|
|
|
|
} catch (GenericEncryptionException $e) {
|
|
|
|
|
// returning 503 will allow retry of the operation at a later point in time
|
|
|
|
|