relax permissions mask check for detecting part file rename

with files drop uploads the original file name isn't always used for the '.ocTransferId' source path

Signed-off-by: Robin Appelman <robin@icewind.nl>
This commit is contained in:
Robin Appelman 2020-06-11 14:22:59 +02:00 committed by backportbot[bot]
parent d4343de3eb
commit 654f5a2109
1 changed files with 3 additions and 7 deletions

View File

@ -80,14 +80,10 @@ class PermissionsMask extends Wrapper {
}
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) {
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);
}