Double check for failed cache with a shared storage

When obtaining the SourceRootInfo we can call init. If this fails the
cache is set to a failed cache and the storage to a failed storage.
However we did not check for this. Which means that if the storage was
invalid it would fail later on.

Now we will properly error out.

Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
This commit is contained in:
Roeland Jago Douma 2018-10-16 10:57:37 +02:00
parent fbf8b327cd
commit e06f57916f
No known key found for this signature in database
GPG Key ID: F941078878347C0C
1 changed files with 3 additions and 1 deletions

View File

@ -370,10 +370,12 @@ class SharedStorage extends \OC\Files\Storage\Wrapper\Jail implements ISharedSto
if (!$storage) {
$storage = $this;
}
$sourceRoot = $this->getSourceRootInfo();
if ($this->storage instanceof FailedStorage) {
return new FailedCache();
}
$this->cache = new \OCA\Files_Sharing\Cache($storage, $this->getSourceRootInfo(), $this->superShare);
$this->cache = new \OCA\Files_Sharing\Cache($storage, $sourceRoot, $this->superShare);
return $this->cache;
}