Check if a folder is deletable before we try to recursively delete it
This commit is contained in:
parent
ab79caf29b
commit
d25a9a118f
|
@ -204,6 +204,9 @@ class Google extends \OC\Files\Storage\Common {
|
|||
}
|
||||
|
||||
public function rmdir($path) {
|
||||
if (!$this->isDeletable($path)) {
|
||||
return false;
|
||||
}
|
||||
if (trim($path, '/') === '') {
|
||||
$dir = $this->opendir($path);
|
||||
if(is_resource($dir)) {
|
||||
|
|
|
@ -21,7 +21,7 @@ abstract class StreamWrapper extends Common {
|
|||
}
|
||||
|
||||
public function rmdir($path) {
|
||||
if ($this->file_exists($path)) {
|
||||
if ($this->file_exists($path) and $this->isDeletable($path)) {
|
||||
$dh = $this->opendir($path);
|
||||
while (($file = readdir($dh)) !== false) {
|
||||
if ($this->is_dir($path . '/' . $file)) {
|
||||
|
|
|
@ -187,7 +187,7 @@ class Swift extends \OC\Files\Storage\Common {
|
|||
public function rmdir($path) {
|
||||
$path = $this->normalizePath($path);
|
||||
|
||||
if (!$this->is_dir($path)) {
|
||||
if (!$this->is_dir($path) or !$this->isDeletable($path)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
|
@ -39,6 +39,9 @@ if (\OC_Util::runningOnWindows()) {
|
|||
}
|
||||
|
||||
public function rmdir($path) {
|
||||
if (!$this->isDeletable($path)) {
|
||||
return false;
|
||||
}
|
||||
try {
|
||||
$it = new \RecursiveIteratorIterator(
|
||||
new \RecursiveDirectoryIterator($this->datadir . $path),
|
||||
|
|
|
@ -38,6 +38,9 @@ class MappedLocal extends \OC\Files\Storage\Common {
|
|||
}
|
||||
|
||||
public function rmdir($path) {
|
||||
if (!$this->isDeletable($path)) {
|
||||
return false;
|
||||
}
|
||||
try {
|
||||
$it = new \RecursiveIteratorIterator(
|
||||
new \RecursiveDirectoryIterator($this->buildPath($path)),
|
||||
|
|
Loading…
Reference in New Issue