diff --git a/lib/private/Files/Storage/Wrapper/PermissionsMask.php b/lib/private/Files/Storage/Wrapper/PermissionsMask.php index 5dbedc76b8d18..4317358ff6792 100644 --- a/lib/private/Files/Storage/Wrapper/PermissionsMask.php +++ b/lib/private/Files/Storage/Wrapper/PermissionsMask.php @@ -71,8 +71,10 @@ public function getPermissions(string $path): int { #[\Override] public function rename(string $source, string $target): bool { //This is a rename of the transfer file to the original file - if (dirname($source) === dirname($target) && strpos($source, '.ocTransferId') > 0) { - return $this->checkMask(Constants::PERMISSION_CREATE) && parent::rename($source, $target); + $sourceDir = dirname($source); + $targetDir = dirname($target); + if (($sourceDir === $targetDir || $sourceDir === dirname($targetDir)) && strpos($source, '.ocTransferId') > 0) { + return $this->checkMask(Constants::PERMISSION_CREATE) and parent::rename($source, $target); } return $this->checkMask(Constants::PERMISSION_UPDATE) && parent::rename($source, $target); }