fix: only mask the permissions for the users home directory for public shares

this ensures that versions/trashbin/etc is still usable

Signed-off-by: Robin Appelman <robin@icewind.nl>
This commit is contained in:
Robin Appelman 2026-04-08 18:00:41 +02:00
parent e96a89e630
commit 3cd3c6dd90
2 changed files with 7 additions and 3 deletions

View file

@ -6,7 +6,7 @@
* SPDX-License-Identifier: AGPL-3.0-only
*/
use OC\Files\Filesystem;
use OC\Files\Storage\Wrapper\PermissionsMask;
use OC\Files\Storage\Wrapper\DirPermissionsMask;
use OC\Files\View;
use OCA\DAV\Connector\LegacyPublicAuth;
use OCA\DAV\Connector\Sabre\ServerFactory;
@ -98,7 +98,11 @@ $server = $serverFactory->createServer(
// FIXME: should not add storage wrappers outside of preSetup, need to find a better way
$previousLog = Filesystem::logWarningWhenAddingStorageWrapper(false);
Filesystem::addStorageWrapper('sharePermissions', function ($mountPoint, $storage) use ($share) {
return new PermissionsMask(['storage' => $storage, 'mask' => $share->getPermissions() | Constants::PERMISSION_SHARE]);
return new DirPermissionsMask([
'storage' => $storage,
'mask' => $share->getPermissions() | Constants::PERMISSION_SHARE,
'path' => 'files'
]);
});
Filesystem::addStorageWrapper('shareOwner', function ($mountPoint, $storage) use ($share) {
return new PublicOwnerWrapper(['storage' => $storage, 'owner' => $share->getShareOwner()]);

View file

@ -157,7 +157,7 @@ class LegacyVersionsBackend implements IVersionBackend, IDeletableVersionBackend
Storage::scheduleExpire($user->getUID(), $relativePath);
// store a new version of a file
$res = $userView->copy('files/' . $relativePath, 'files_versions/' . $relativePath . '.v' . $file->getMtime());
$userView->copy('files/' . $relativePath, 'files_versions/' . $relativePath . '.v' . $file->getMtime());
// ensure the file is scanned
$userView->getFileInfo('files_versions/' . $relativePath . '.v' . $file->getMtime());
}