Check if a folder is deletable before we try to recursively delete it

This commit is contained in:
Robin Appelman 2014-08-25 14:06:48 +02:00 committed by Lukas Reschke
parent ab79caf29b
commit d25a9a118f
5 changed files with 11 additions and 2 deletions

View File

@ -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)) {

View File

@ -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)) {

View 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;
}

View File

@ -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),

View File

@ -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)),