Skip to content

Commit f2ce921

Browse files
committed
fix: Fix permission issue when uploading a chunked file
Follow up from #59511 Signed-off-by: Carl Schwan <carlschwan@kde.org>
1 parent abd693e commit f2ce921

2 files changed

Lines changed: 8 additions & 4 deletions

File tree

apps/dav/appinfo/v2/publicremote.php

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
* SPDX-License-Identifier: AGPL-3.0-only
77
*/
88
use OC\Files\Filesystem;
9-
use OC\Files\Storage\Wrapper\PermissionsMask;
9+
use OC\Files\Storage\Wrapper\DirPermissionsMask;
1010
use OC\Files\View;
1111
use OCA\DAV\Connector\Sabre\PublicAuth;
1212
use OCA\DAV\Connector\Sabre\ServerFactory;
@@ -113,10 +113,14 @@
113113
// For chunked uploads it is necessary to have read and delete permission,
114114
// so the temporary directory, chunks and destination file can be read and delete after the assembly.
115115
if (str_starts_with(substr($requestUri, strlen($baseuri) - 1), '/uploads/')) {
116-
$mask |= Constants::PERMISSION_READ | Constants::PERMISSION_DELETE;
116+
$mask |= Constants::PERMISSION_READ | Constants::PERMISSION_DELETE | Constants::PERMISSION_UPDATE;
117117
}
118118

119-
return new PermissionsMask(['storage' => $storage, 'mask' => $mask]);
119+
return new DirPermissionsMask([
120+
'storage' => $storage,
121+
'mask' => $mask,
122+
'path' => 'files',
123+
]);
120124
});
121125

122126
/** @psalm-suppress MissingClosureParamType */

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ public function getPermissions($path): int {
8888
}
8989

9090
public function rename($source, $target): bool {
91-
if (!$this->isUpdatable($source)) {
91+
if (!$this->isDeletable($source)) {
9292
return false;
9393
}
9494

0 commit comments

Comments
 (0)