diff options
Diffstat (limited to 'lib/private/files/view.php')
-rw-r--r-- | lib/private/files/view.php | 22 |
1 files changed, 16 insertions, 6 deletions
diff --git a/lib/private/files/view.php b/lib/private/files/view.php index f06c2fcd66c..94be7114865 100644 --- a/lib/private/files/view.php +++ b/lib/private/files/view.php @@ -832,6 +832,9 @@ class View { $user = \OC_User::getUser(); if (!$cache->inCache($internalPath)) { + if (!$storage->file_exists($internalPath)) { + return false; + } $scanner = $storage->getScanner($internalPath); $scanner->scan($internalPath, Cache\Scanner::SCAN_SHALLOW); } else { @@ -1129,15 +1132,22 @@ class View { * @return string */ public function getPath($id) { - list($storage, $internalPath) = Cache\Cache::getById($id); - $mounts = Filesystem::getMountByStorageId($storage); + $manager = Filesystem::getMountManager(); + $mounts = $manager->findIn($this->fakeRoot); + $mounts[] = $manager->find($this->fakeRoot); + // reverse the array so we start with the storage this view is in + // which is the most likely to contain the file we're looking for + $mounts = array_reverse($mounts); foreach ($mounts as $mount) { /** - * @var \OC\Files\Mount $mount + * @var \OC\Files\Mount\Mount $mount */ - $fullPath = $mount->getMountPoint() . $internalPath; - if (!is_null($path = $this->getRelativePath($fullPath))) { - return $path; + $cache = $mount->getStorage()->getCache(); + if ($internalPath = $cache->getPathById($id)) { + $fullPath = $mount->getMountPoint() . $internalPath; + if (!is_null($path = $this->getRelativePath($fullPath))) { + return $path; + } } } return null; |