summaryrefslogtreecommitdiffstats
path: root/lib/private/files/view.php
diff options
context:
space:
mode:
Diffstat (limited to 'lib/private/files/view.php')
-rw-r--r--lib/private/files/view.php20
1 files changed, 18 insertions, 2 deletions
diff --git a/lib/private/files/view.php b/lib/private/files/view.php
index ac45a881331..d97544b865e 100644
--- a/lib/private/files/view.php
+++ b/lib/private/files/view.php
@@ -336,6 +336,19 @@ class View {
}
public function unlink($path) {
+ if ($path === '' || $path === '/') {
+ // do not allow deleting the root
+ return false;
+ }
+ $postFix = (substr($path, -1, 1) === '/') ? '/' : '';
+ $absolutePath = Filesystem::normalizePath($this->getAbsolutePath($path));
+ list($storage, $internalPath) = Filesystem::resolvePath($absolutePath . $postFix);
+ if (!$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
+ return false;
+ }
return $this->basicOperation('unlink', $path, array('delete'));
}
@@ -788,6 +801,7 @@ class View {
* @var string $internalPath
*/
list($storage, $internalPath) = Filesystem::resolvePath($path);
+ $data = null;
if ($storage) {
$cache = $storage->getCache($internalPath);
$permissionsCache = $storage->getPermissionsCache($internalPath);
@@ -798,10 +812,12 @@ class View {
$scanner->scan($internalPath, Cache\Scanner::SCAN_SHALLOW);
} else {
$watcher = $storage->getWatcher($internalPath);
- $watcher->checkUpdate($internalPath);
+ $data = $watcher->checkUpdate($internalPath);
}
- $data = $cache->get($internalPath);
+ if (!is_array($data)) {
+ $data = $cache->get($internalPath);
+ }
if ($data and $data['fileid']) {
if ($includeMountPoints and $data['mimetype'] === 'httpd/unix-directory') {