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:44:43 +0100 |
commit | 003bb0aca42f103410d25b0458769121392ff8dd (patch) | |
tree | 62d8ea948495f4ae552330eb1da7dfa9752a80c3 /lib | |
parent | ee54c171973754c0395b8794a50086ce15a4152f (diff) | |
download | nextcloud-server-003bb0aca42f103410d25b0458769121392ff8dd.tar.gz nextcloud-server-003bb0aca42f103410d25b0458769121392ff8dd.zip |
fix(storage): Try to delete existing targetbackport/49315/stable30
Signed-off-by: Git'Fellow <12234510+solracsf@users.noreply.github.com>
Diffstat (limited to 'lib')
-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 d4f3d1ddc84..49fdde5636b 100644 --- a/lib/private/Files/Storage/Common.php +++ b/lib/private/Files/Storage/Common.php @@ -68,13 +68,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 869b309b2b4..c51be70d31d 100644 --- a/lib/private/Files/Storage/Local.php +++ b/lib/private/Files/Storage/Local.php @@ -345,10 +345,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)) { |