]> source.dussan.org Git - nextcloud-server.git/commitdiff
fix(storage): Try to delete existing target backport/49315/stable28 49411/head
authorGit'Fellow <12234510+solracsf@users.noreply.github.com>
Fri, 15 Nov 2024 18:50:16 +0000 (19:50 +0100)
committerGit'Fellow <12234510+solracsf@users.noreply.github.com>
Thu, 21 Nov 2024 06:34:06 +0000 (07:34 +0100)
Signed-off-by: Git'Fellow <12234510+solracsf@users.noreply.github.com>
lib/private/Files/Storage/Common.php
lib/private/Files/Storage/Local.php

index fd447d3fa86a6b3cbc53e4c2d767b61ed8f4ee82..e363054c909dde3c8c1bb7c8d4d0e24f23d706fa 100644 (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) {
index 1b908cb2350bfbfd6acd0a54db27f84ac5566f25..7dbec7716d8c866c4d6e63345f997b345d45e3cb 100644 (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)) {