Fix delTree(), it shouldn't be passed to the local storage provider unless the user has delete permission
This commit is contained in:
parent
c185743ae9
commit
a14a83b9c6
|
@ -402,10 +402,6 @@ class OC_Filestorage_Shared extends OC_Filestorage {
|
||||||
OC_Share::setTarget($target, "/");
|
OC_Share::setTarget($target, "/");
|
||||||
} else {
|
} else {
|
||||||
OC_Share::pullOutOfFolder($target, "/");
|
OC_Share::pullOutOfFolder($target, "/");
|
||||||
// If this is a folder being deleted, call setTarget in case there are any database entries inside the folder
|
|
||||||
if (self::is_dir($path)) {
|
|
||||||
OC_Share::setTarget($target, "/");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
// Delete the database entry
|
// Delete the database entry
|
||||||
} else {
|
} else {
|
||||||
|
@ -440,8 +436,8 @@ class OC_Filestorage_Shared extends OC_Filestorage {
|
||||||
}
|
}
|
||||||
$this->clearFolderSizeCache($this->getInternalPath($oldTarget));
|
$this->clearFolderSizeCache($this->getInternalPath($oldTarget));
|
||||||
$this->clearFolderSizeCache($this->getInternalPath($newTarget));
|
$this->clearFolderSizeCache($this->getInternalPath($newTarget));
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function copy($path1, $path2) {
|
public function copy($path1, $path2) {
|
||||||
|
@ -502,10 +498,30 @@ class OC_Filestorage_Shared extends OC_Filestorage {
|
||||||
}
|
}
|
||||||
|
|
||||||
public function delTree($path) {
|
public function delTree($path) {
|
||||||
$source = $this->getSource($path);
|
$target = $this->datadir.$path;
|
||||||
if ($source) {
|
if (OC_Share::getPermissions($target) & OC_Share::DELETE) {
|
||||||
$storage = OC_Filesystem::getStorage($source);
|
$source = $this->getSource($path);
|
||||||
return $storage->delTree($this->getInternalPath($source));
|
if ($source) {
|
||||||
|
$storage = OC_Filesystem::getStorage($source);
|
||||||
|
return $storage->delTree($this->getInternalPath($source));
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
// Check if the folder is inside a shared folder
|
||||||
|
if (OC_Share::getParentFolders($target)) {
|
||||||
|
// If entry for folder already exists
|
||||||
|
if (OC_Share::getItem($target)) {
|
||||||
|
OC_Share::setTarget($target, "/");
|
||||||
|
} else {
|
||||||
|
OC_Share::pullOutOfFolder($target, "/");
|
||||||
|
// Call setTarget in case there are any database entries for items inside this folder
|
||||||
|
OC_Share::setTarget($target, "/");
|
||||||
|
}
|
||||||
|
// Delete the database entry
|
||||||
|
} else {
|
||||||
|
OC_Share::unshareFromMySelf($target);
|
||||||
|
}
|
||||||
|
$this->clearFolderSizeCache($this->getInternalPath($target));
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue