Merge pull request #21573 from nextcloud/backport/21558/stable19

[stable19] relax permissions mask check for detecting part file rename
This commit is contained in:
Morris Jobke 2020-07-02 23:51:03 +02:00 committed by GitHub
commit f70b2dba18
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 7 deletions

View File

@ -80,13 +80,9 @@ class PermissionsMask extends Wrapper {
} }
public function rename($path1, $path2) { public function rename($path1, $path2) {
$p = strpos($path1, $path2); //This is a rename of the transfer file to the original file
if ($p === 0) { if (dirname($path1) === dirname($path2) && strpos($path1, '.ocTransferId') > 0) {
$part = substr($path1, strlen($path2)); return $this->checkMask(Constants::PERMISSION_CREATE) and parent::rename($path1, $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);
}
} }
return $this->checkMask(Constants::PERMISSION_UPDATE) and parent::rename($path1, $path2); return $this->checkMask(Constants::PERMISSION_UPDATE) and parent::rename($path1, $path2);
} }