aboutsummaryrefslogtreecommitdiffstats
path: root/lib/private
diff options
context:
space:
mode:
authorThomas Müller <thomas.mueller@tmit.eu>2014-06-06 09:44:57 +0200
committerThomas Müller <thomas.mueller@tmit.eu>2014-06-06 09:44:57 +0200
commit79b65269c9e1dd1cd01dc2fd28a979105650fc91 (patch)
tree296bf93fea8aec3c1eb39ba942d284c483910b60 /lib/private
parent1745fe1664e6e2079b170a2c46c8de5d12beac3c (diff)
parentd359765bdc028eef18a4aab05944faa9ced596ea (diff)
downloadnextcloud-server-79b65269c9e1dd1cd01dc2fd28a979105650fc91.tar.gz
nextcloud-server-79b65269c9e1dd1cd01dc2fd28a979105650fc91.zip
Merge pull request #8877 from owncloud/getpath-storage-check
Verify that we have a valid storage in View->getPath
Diffstat (limited to 'lib/private')
-rw-r--r--lib/private/files/view.php20
1 files changed, 12 insertions, 8 deletions
diff --git a/lib/private/files/view.php b/lib/private/files/view.php
index 09b100d7cfd..1dc6c405bcf 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)
@@ -1125,7 +1127,7 @@ class View {
* Note that the resulting path is not guarantied to be unique for the id, multiple paths can point to the same file
*
* @param int $id
- * @return string
+ * @return string|null
*/
public function getPath($id) {
$manager = Filesystem::getMountManager();
@@ -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;
+ }
}
}
}