Skip to content

Commit

Permalink
Merge pull request #21558 from nextcloud/part-file-rename-mask
Browse files Browse the repository at this point in the history
relax permissions mask check for detecting part file rename
  • Loading branch information
rullzer authored Jun 24, 2020
2 parents b4b7de5 + 35d75db commit b6ce750
Showing 1 changed file with 3 additions and 7 deletions.
10 changes: 3 additions & 7 deletions lib/private/Files/Storage/Wrapper/PermissionsMask.php
Original file line number Diff line number Diff line change
Expand Up @@ -80,13 +80,9 @@ public function getPermissions($path) {
}

public function rename($path1, $path2) {
$p = strpos($path1, $path2);
if ($p === 0) {
$part = substr($path1, strlen($path2));
//This is a rename of the transfer file to the original file
if (strpos($part, '.ocTransferId') === 0) {
return $this->checkMask(Constants::PERMISSION_CREATE) and parent::rename($path1, $path2);
}
//This is a rename of the transfer file to the original file
if (dirname($path1) === dirname($path2) && strpos($path1, '.ocTransferId') > 0) {
return $this->checkMask(Constants::PERMISSION_CREATE) and parent::rename($path1, $path2);
}
return $this->checkMask(Constants::PERMISSION_UPDATE) and parent::rename($path1, $path2);
}
Expand Down

0 comments on commit b6ce750

Please sign in to comment.