]> source.dussan.org Git - nextcloud-server.git/commitdiff
fix(storage): Try to delete existing target backport/49315/stable30 49410/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:44:43 +0000 (07:44 +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 d4f3d1ddc847dd6042e66b9d5b25f3fce64fed8b..49fdde5636b017ec645dd87632f3b65ed12e65f8 100644 (file)
@@ -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) {
index 869b309b2b45390251e7f92f001f160a64dd95be..c51be70d31dc8b6376334a0b9e56c3721de8df9c 100644 (file)
@@ -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)) {