Skip to content

Commit f9cc07f

Browse files
authored
Merge pull request #21572 from nextcloud/backport/21558/stable18
[stable18] relax permissions mask check for detecting part file rename
2 parents 073b702 + a2ebe6d commit f9cc07f

File tree

1 file changed

+3
-7
lines changed

1 file changed

+3
-7
lines changed

lib/private/Files/Storage/Wrapper/PermissionsMask.php

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -80,13 +80,9 @@ public function getPermissions($path) {
8080
}
8181

8282
public function rename($path1, $path2) {
83-
$p = strpos($path1, $path2);
84-
if ($p === 0) {
85-
$part = substr($path1, strlen($path2));
86-
//This is a rename of the transfer file to the original file
87-
if (strpos($part, '.ocTransferId') === 0) {
88-
return $this->checkMask(Constants::PERMISSION_CREATE) and parent::rename($path1, $path2);
89-
}
83+
//This is a rename of the transfer file to the original file
84+
if (dirname($path1) === dirname($path2) && strpos($path1, '.ocTransferId') > 0) {
85+
return $this->checkMask(Constants::PERMISSION_CREATE) and parent::rename($path1, $path2);
9086
}
9187
return $this->checkMask(Constants::PERMISSION_UPDATE) and parent::rename($path1, $path2);
9288
}

0 commit comments

Comments
 (0)