Skip to content

Commit

Permalink
Merge pull request #49410 from nextcloud/backport/49315/stable30
Browse files Browse the repository at this point in the history
  • Loading branch information
skjnldsv authored Nov 21, 2024
2 parents 824536d + 003bb0a commit 2ebcfad
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 10 deletions.
13 changes: 7 additions & 6 deletions lib/private/Files/Storage/Common.php
Original file line number Diff line number Diff line change
Expand Up @@ -68,13 +68,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 @@ -345,10 +345,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 2ebcfad

Please sign in to comment.