summaryrefslogtreecommitdiffstats
path: root/lib/private/files/view.php
diff options
context:
space:
mode:
authorThomas Müller <thomas.mueller@tmit.eu>2013-10-16 15:36:35 +0200
committerThomas Müller <thomas.mueller@tmit.eu>2013-10-16 15:36:35 +0200
commit8c2b0b13941b090140ad5634df6602a180afbc03 (patch)
tree47b3ee8572c67c9975a21f0c79f9cdd3b105f22a /lib/private/files/view.php
parent8e97752bf76aa3b7fb15d734259a9dcd0d82cc73 (diff)
parentdb31541fe13510ca4d1b752d7ac5a08ea8e89310 (diff)
downloadnextcloud-server-8c2b0b13941b090140ad5634df6602a180afbc03.tar.gz
nextcloud-server-8c2b0b13941b090140ad5634df6602a180afbc03.zip
Merge branch 'master' into activities-api
Diffstat (limited to 'lib/private/files/view.php')
-rw-r--r--lib/private/files/view.php15
1 files changed, 11 insertions, 4 deletions
diff --git a/lib/private/files/view.php b/lib/private/files/view.php
index aa08a5f7cc9..c0b9f0fc9c8 100644
--- a/lib/private/files/view.php
+++ b/lib/private/files/view.php
@@ -110,7 +110,9 @@ class View {
* @return array consisting of the storage and the internal path
*/
public function resolvePath($path) {
- return Filesystem::resolvePath($this->getAbsolutePath($path));
+ $a = $this->getAbsolutePath($path);
+ $p = Filesystem::normalizePath($a);
+ return Filesystem::resolvePath($p);
}
/**
@@ -324,7 +326,8 @@ class View {
return false;
}
} else {
- return $this->basicOperation('file_put_contents', $path, array('create', 'write'), $data);
+ $hooks = ($this->file_exists($path)) ? array('write') : array('create', 'write');
+ return $this->basicOperation('file_put_contents', $path, $hooks, $data);
}
}
@@ -709,7 +712,10 @@ class View {
return false;
}
$defaultRoot = Filesystem::getRoot();
- return (strlen($this->fakeRoot) >= strlen($defaultRoot)) && (substr($this->fakeRoot, 0, strlen($defaultRoot)) === $defaultRoot);
+ if($this->fakeRoot === $defaultRoot){
+ return true;
+ }
+ return (strlen($this->fakeRoot) > strlen($defaultRoot)) && (substr($this->fakeRoot, 0, strlen($defaultRoot) + 1) === $defaultRoot . '/');
}
private function runHooks($hooks, $path, $post = false) {
@@ -898,7 +904,8 @@ class View {
$permissions = $subStorage->getPermissions($rootEntry['path']);
$subPermissionsCache->set($rootEntry['fileid'], $user, $permissions);
}
- $rootEntry['permissions'] = $permissions;
+ // do not allow renaming/deleting the mount point
+ $rootEntry['permissions'] = $permissions & (\OCP\PERMISSION_ALL - (\OCP\PERMISSION_UPDATE | \OCP\PERMISSION_DELETE));
//remove any existing entry with the same name
foreach ($files as $i => $file) {