aboutsummaryrefslogtreecommitdiffstats
path: root/lib/private
diff options
context:
space:
mode:
authorGit'Fellow <12234510+solracsf@users.noreply.github.com>2024-11-15 19:50:16 +0100
committerGit'Fellow <12234510+solracsf@users.noreply.github.com>2024-11-21 07:41:54 +0100
commit8ec775bc84d789b259395c836bf16d54149a60b8 (patch)
tree66a7eed9a9f7b632e622b5897457a87b941eed2e /lib/private
parente18153a882f78e2a9ccb869eeb03786ac4ea6b83 (diff)
downloadnextcloud-server-8ec775bc84d789b259395c836bf16d54149a60b8.tar.gz
nextcloud-server-8ec775bc84d789b259395c836bf16d54149a60b8.zip
fix(storage): Try to delete existing targetbackport/49315/stable29
Signed-off-by: Git'Fellow <12234510+solracsf@users.noreply.github.com>
Diffstat (limited to 'lib/private')
-rw-r--r--lib/private/Files/Storage/Common.php13
-rw-r--r--lib/private/Files/Storage/Local.php10
2 files changed, 13 insertions, 10 deletions
diff --git a/lib/private/Files/Storage/Common.php b/lib/private/Files/Storage/Common.php
index d2a344a8217..cff19e33dce 100644
--- a/lib/private/Files/Storage/Common.php
+++ b/lib/private/Files/Storage/Common.php
@@ -108,13 +108,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 ca2113add75..8fec2499689 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)) {