diff options
author | Michael Gapczynski <GapczynskiM@gmail.com> | 2011-08-17 21:58:53 -0400 |
---|---|---|
committer | Michael Gapczynski <GapczynskiM@gmail.com> | 2011-08-17 21:58:53 -0400 |
commit | b4cf61ee324bb5b82710f344dfd5a97ac3234e10 (patch) | |
tree | 66b0aa892228fdb37f1d3fed965bbed3eda40b5a | |
parent | 4078e0a24249183e15a02e5955ea821e75775016 (diff) | |
download | nextcloud-server-b4cf61ee324bb5b82710f344dfd5a97ac3234e10.tar.gz nextcloud-server-b4cf61ee324bb5b82710f344dfd5a97ac3234e10.zip |
Bug fixes for mkdir(), renaming/moving support for files inside a shared folder with write permission
-rw-r--r-- | apps/files_sharing/sharedstorage.php | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/apps/files_sharing/sharedstorage.php b/apps/files_sharing/sharedstorage.php index 9650770ab27..c3e75c8f1e5 100644 --- a/apps/files_sharing/sharedstorage.php +++ b/apps/files_sharing/sharedstorage.php @@ -60,15 +60,13 @@ class OC_Filestorage_Shared extends OC_Filestorage { } public function mkdir($path) { - if ($path == "" || $path == "/") { + if ($path == "" || $path == "/" || !$this->is_writeable($path)) { return false; } else { $source = $this->getSource($path); if ($source) { - if ($this->is_writeable($path)) { - $storage = OC_Filesystem::getStorage($source); - return $storage->mkdir($this->getInternalPath($source)); - } + $storage = OC_Filesystem::getStorage($source); + return $storage->mkdir($this->getInternalPath($source)); } } } @@ -422,10 +420,14 @@ class OC_Filestorage_Shared extends OC_Filestorage { $oldTarget = $this->datadir.$path1; $newTarget = $this->datadir.$path2; // Check if the item is inside a shared folder - if (OC_Share::getParentFolders($oldTarget)) { - if ($this->is_writeable($path1)) { + if ($folders = OC_Share::getParentFolders($oldTarget)) { + $root1 = substr($path1, 0, strpos($path1, "/")); + $root2 = substr($path1, 0, strpos($path2, "/")); + if ($root1 !== $root2) { + return false; + } else if ($this->is_writeable($path1) && $this->is_writeable($path2)) { $oldSource = $this->getSource($path1); - $newSource = dirname($oldSource)."/".basename($path2); + $newSource = $folders['source'].substr($newTarget, strlen($folders['target'])); if ($oldSource) { $storage = OC_Filesystem::getStorage($oldSource); return $storage->rename($this->getInternalPath($oldSource), $this->getInternalPath($newSource)); |