fix(storage): Try to delete existing target

Signed-off-by: Git'Fellow <12234510+solracsf@users.noreply.github.com>

Add same logic to common storage
pull/49315/head
Git'Fellow 2024-11-15 19:50:16 +07:00
parent a4c1a75ee6
commit 8755bf1815
2 changed files with 15 additions and 10 deletions

@ -69,13 +69,16 @@ abstract class Common implements Storage, ILockingStorage, IWriteStreamStorage,
}
protected function remove(string $path): bool {
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);
} else {
return false;
}
}
return false;
}
public function is_dir(string $path): bool {

@ -342,10 +342,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)) {