Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
fix(storage): Try to delete existing target
Signed-off-by: Git'Fellow <[email protected]>
  • Loading branch information
solracsf committed Nov 21, 2024
commit 85e320bde238a6b12f4dbc419ce7bc4502e4e7c4
13 changes: 7 additions & 6 deletions lib/private/Files/Storage/Common.php
Original file line number Diff line number Diff line change
Expand Up @@ -106,13 +106,14 @@ public function __construct($parameters) {
* @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) {
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
Loading