diff options
author | Robin Appelman <icewind@owncloud.com> | 2014-06-04 17:08:25 +0200 |
---|---|---|
committer | Robin Appelman <icewind@owncloud.com> | 2014-06-05 15:50:19 +0200 |
commit | 00539cf8f9591639ca82caea22b41fd1d95a558b (patch) | |
tree | ec9e8d79163026050600e5a1aa8fe23620c1f872 /lib | |
parent | 0ce1f34f8a8b7a42d3c4482d9c09be93aa31768c (diff) | |
download | nextcloud-server-00539cf8f9591639ca82caea22b41fd1d95a558b.tar.gz nextcloud-server-00539cf8f9591639ca82caea22b41fd1d95a558b.zip |
Verify that we have a valid storage in View->getPath
Diffstat (limited to 'lib')
-rw-r--r-- | lib/private/files/view.php | 18 |
1 files changed, 11 insertions, 7 deletions
diff --git a/lib/private/files/view.php b/lib/private/files/view.php index 09b100d7cfd..6eacf34d727 100644 --- a/lib/private/files/view.php +++ b/lib/private/files/view.php @@ -359,7 +359,8 @@ class View { $absolutePath = Filesystem::normalizePath($this->getAbsolutePath($path)); list($storage, $internalPath) = Filesystem::resolvePath($absolutePath . $postFix); if (!($storage instanceof \OC\Files\Storage\Shared) && - (!$internalPath || $internalPath === '' || $internalPath === '/')) { + (!$internalPath || $internalPath === '' || $internalPath === '/') + ) { // do not allow deleting the storage's root / the mount point // because for some storages it might delete the whole contents // but isn't supposed to work that way @@ -678,6 +679,7 @@ class View { /** * abstraction layer for basic filesystem functions: wrapper for \OC\Files\Storage\Storage + * * @param string $operation * @param string $path * @param array $hooks (optional) @@ -1138,12 +1140,14 @@ class View { /** * @var \OC\Files\Mount\Mount $mount */ - $cache = $mount->getStorage()->getCache(); - $internalPath = $cache->getPathById($id); - if (is_string($internalPath)) { - $fullPath = $mount->getMountPoint() . $internalPath; - if (!is_null($path = $this->getRelativePath($fullPath))) { - return $path; + if ($mount->getStorage()) { + $cache = $mount->getStorage()->getCache(); + $internalPath = $cache->getPathById($id); + if (is_string($internalPath)) { + $fullPath = $mount->getMountPoint() . $internalPath; + if (!is_null($path = $this->getRelativePath($fullPath))) { + return $path; + } } } } |