diff options
author | Git'Fellow <12234510+solracsf@users.noreply.github.com> | 2024-11-15 19:50:16 +0100 |
---|---|---|
committer | Git'Fellow <12234510+solracsf@users.noreply.github.com> | 2024-11-21 07:34:06 +0100 |
commit | 85e320bde238a6b12f4dbc419ce7bc4502e4e7c4 (patch) | |
tree | 4539fe1fce0688176d7465094c340fd6d6d9347b | |
parent | b2464dc43b02363420a8c6ac57d1d70b65cbeae2 (diff) | |
download | nextcloud-server-85e320bde238a6b12f4dbc419ce7bc4502e4e7c4.tar.gz nextcloud-server-85e320bde238a6b12f4dbc419ce7bc4502e4e7c4.zip |
fix(storage): Try to delete existing targetbackport/49315/stable28
Signed-off-by: Git'Fellow <12234510+solracsf@users.noreply.github.com>
-rw-r--r-- | lib/private/Files/Storage/Common.php | 13 | ||||
-rw-r--r-- | lib/private/Files/Storage/Local.php | 10 |
2 files changed, 13 insertions, 10 deletions
diff --git a/lib/private/Files/Storage/Common.php b/lib/private/Files/Storage/Common.php index fd447d3fa86..e363054c909 100644 --- a/lib/private/Files/Storage/Common.php +++ b/lib/private/Files/Storage/Common.php @@ -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) { diff --git a/lib/private/Files/Storage/Local.php b/lib/private/Files/Storage/Local.php index 1b908cb2350..7dbec7716d8 100644 --- a/lib/private/Files/Storage/Local.php +++ b/lib/private/Files/Storage/Local.php @@ -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)) { |