Skip to content

Commit 5b09c92

Browse files
solracsfbackportbot[bot]
authored andcommitted
fix(storage): Try to delete existing target
Signed-off-by: Git'Fellow <12234510+solracsf@users.noreply.github.com> Add same logic to common storage [skip ci]
1 parent b2464dc commit 5b09c92

File tree

2 files changed

+7
-4
lines changed

2 files changed

+7
-4
lines changed

lib/private/Files/Storage/Common.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,7 @@ protected function remove($path) {
113113
} else {
114114
return false;
115115
}
116+
return false;
116117
}
117118

118119
public function is_dir($path) {

lib/private/Files/Storage/Local.php

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -380,10 +380,12 @@ public function rename($source, $target): bool {
380380
return false;
381381
}
382382

383-
if ($this->is_dir($target)) {
384-
$this->rmdir($target);
385-
} elseif ($this->is_file($target)) {
386-
$this->unlink($target);
383+
if ($this->file_exists($target)) {
384+
if ($this->is_dir($target)) {
385+
$this->rmdir($target);
386+
} elseif ($this->is_file($target)) {
387+
$this->unlink($target);
388+
}
387389
}
388390

389391
if ($this->is_dir($source)) {

0 commit comments

Comments
 (0)