fix(storage): Try to delete existing target

Signed-off-by: Git'Fellow <12234510+solracsf@users.noreply.github.com>
This commit is contained in:
Git'Fellow 2024-11-15 19:50:16 +01:00
parent b2464dc43b
commit 85e320bde2
2 changed files with 13 additions and 10 deletions

View file

@ -106,13 +106,14 @@ abstract class Common implements Storage, ILockingStorage, IWriteStreamStorage {
* @return bool
*/
protected function remove($path) {
if ($this->is_dir($path)) {
return $this->rmdir($path);
} elseif ($this->is_file($path)) {
return $this->unlink($path);
} else {
return false;
if ($this->file_exists($path)) {
if ($this->is_dir($path)) {
return $this->rmdir($path);
} elseif ($this->is_file($path)) {
return $this->unlink($path);
}
}
return false;
}
public function is_dir($path) {

View file

@ -380,10 +380,12 @@ class Local extends \OC\Files\Storage\Common {
return false;
}
if ($this->is_dir($target)) {
$this->rmdir($target);
} elseif ($this->is_file($target)) {
$this->unlink($target);
if ($this->file_exists($target)) {
if ($this->is_dir($target)) {
$this->rmdir($target);
} elseif ($this->is_file($target)) {
$this->unlink($target);
}
}
if ($this->is_dir($source)) {