Skip to content

Commit

Permalink
fix(storage): Try to delete existing target
Browse files Browse the repository at this point in the history
Signed-off-by: Git'Fellow <[email protected]>

Add same logic to common storage

[skip ci]
  • Loading branch information
solracsf authored and backportbot[bot] committed Nov 20, 2024
1 parent b2464dc commit 5b09c92
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
1 change: 1 addition & 0 deletions lib/private/Files/Storage/Common.php
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,7 @@ protected function remove($path) {
} else {
return false;
}
return false;
}

public function is_dir($path) {
Expand Down
10 changes: 6 additions & 4 deletions lib/private/Files/Storage/Local.php
Original file line number Diff line number Diff line change
Expand Up @@ -380,10 +380,12 @@ public function rename($source, $target): bool {
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)) {
Expand Down

0 comments on commit 5b09c92

Please sign in to comment.