Verify that we have a valid storage in View->getPath
This commit is contained in:
parent
0ce1f34f8a
commit
00539cf8f9
|
@ -359,7 +359,8 @@ class View {
|
||||||
$absolutePath = Filesystem::normalizePath($this->getAbsolutePath($path));
|
$absolutePath = Filesystem::normalizePath($this->getAbsolutePath($path));
|
||||||
list($storage, $internalPath) = Filesystem::resolvePath($absolutePath . $postFix);
|
list($storage, $internalPath) = Filesystem::resolvePath($absolutePath . $postFix);
|
||||||
if (!($storage instanceof \OC\Files\Storage\Shared) &&
|
if (!($storage instanceof \OC\Files\Storage\Shared) &&
|
||||||
(!$internalPath || $internalPath === '' || $internalPath === '/')) {
|
(!$internalPath || $internalPath === '' || $internalPath === '/')
|
||||||
|
) {
|
||||||
// do not allow deleting the storage's root / the mount point
|
// do not allow deleting the storage's root / the mount point
|
||||||
// because for some storages it might delete the whole contents
|
// because for some storages it might delete the whole contents
|
||||||
// but isn't supposed to work that way
|
// 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
|
* abstraction layer for basic filesystem functions: wrapper for \OC\Files\Storage\Storage
|
||||||
|
*
|
||||||
* @param string $operation
|
* @param string $operation
|
||||||
* @param string $path
|
* @param string $path
|
||||||
* @param array $hooks (optional)
|
* @param array $hooks (optional)
|
||||||
|
@ -1138,12 +1140,14 @@ class View {
|
||||||
/**
|
/**
|
||||||
* @var \OC\Files\Mount\Mount $mount
|
* @var \OC\Files\Mount\Mount $mount
|
||||||
*/
|
*/
|
||||||
$cache = $mount->getStorage()->getCache();
|
if ($mount->getStorage()) {
|
||||||
$internalPath = $cache->getPathById($id);
|
$cache = $mount->getStorage()->getCache();
|
||||||
if (is_string($internalPath)) {
|
$internalPath = $cache->getPathById($id);
|
||||||
$fullPath = $mount->getMountPoint() . $internalPath;
|
if (is_string($internalPath)) {
|
||||||
if (!is_null($path = $this->getRelativePath($fullPath))) {
|
$fullPath = $mount->getMountPoint() . $internalPath;
|
||||||
return $path;
|
if (!is_null($path = $this->getRelativePath($fullPath))) {
|
||||||
|
return $path;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue