Skip to content

Commit 1fefe18

Browse files
committed
Make sure we set init the storage before trying to get the cache
without the init the following could happen if there had been no access to the storage yet. 1. Call getCache 2. Since the storage is not init yet, $this->cache and $this->storage are not set yet 3. Construct a new \OCA\Files_Sharing\Cache i. This calls $this->getSourceRootInfo() ii. This then calls init iii. Init fails and sets storage to FailedStorage and cache to FailedCache 4. We set cache to the newly constructed \OCA\Files_Sharing\Cache * It should just be a FailedCache Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
1 parent e513506 commit 1fefe18

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

apps/files_sharing/lib/SharedStorage.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@
4040
use OCP\Files\Cache\ICacheEntry;
4141
use OCP\Files\NotFoundException;
4242
use OCP\Files\Storage\IStorage;
43+
use OCP\Files\StorageNotAvailableException;
4344
use OCP\Lock\ILockingProvider;
4445
use OC\User\NoUserException;
4546

@@ -114,6 +115,7 @@ private function init() {
114115
return;
115116
}
116117
$this->initialized = true;
118+
117119
try {
118120
Filesystem::initMountPoints($this->superShare->getShareOwner());
119121
$sourcePath = $this->ownerView->getPath($this->superShare->getNodeId());
@@ -357,6 +359,8 @@ public function getItemType() {
357359
* @return Cache
358360
*/
359361
public function getCache($path = '', $storage = null) {
362+
$this->init();
363+
360364
if ($this->cache) {
361365
return $this->cache;
362366
}

0 commit comments

Comments
 (0)