Skip to content

Commit e11d824

Browse files
committed
fix(dav): correctly mask public v1 links for non-home storages
fix(dav): correctly mask public v1 links for non-home storages Signed-off-by: Kent Delante <kent@delante.me> [skip ci]
1 parent 7793825 commit e11d824

1 file changed

Lines changed: 13 additions & 5 deletions

File tree

apps/dav/appinfo/v1/publicwebdav.php

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
*/
88
use OC\Files\Filesystem;
99
use OC\Files\Storage\Wrapper\DirPermissionsMask;
10+
use OC\Files\Storage\Wrapper\PermissionsMask;
1011
use OC\Files\View;
1112
use OCA\DAV\Connector\LegacyPublicAuth;
1213
use OCA\DAV\Connector\Sabre\ServerFactory;
@@ -17,6 +18,7 @@
1718
use OCP\BeforeSabrePubliclyLoadedEvent;
1819
use OCP\Constants;
1920
use OCP\EventDispatcher\IEventDispatcher;
21+
use OCP\Files\IHomeStorage;
2022
use OCP\Files\IRootFolder;
2123
use OCP\Files\Mount\IMountManager;
2224
use OCP\IConfig;
@@ -93,11 +95,17 @@ function (\Sabre\DAV\Server $server) use (
9395
// FIXME: should not add storage wrappers outside of preSetup, need to find a better way
9496
$previousLog = Filesystem::logWarningWhenAddingStorageWrapper(false);
9597
Filesystem::addStorageWrapper('sharePermissions', function ($mountPoint, $storage) use ($share) {
96-
return new DirPermissionsMask([
97-
'storage' => $storage,
98-
'mask' => $share->getPermissions() | Constants::PERMISSION_SHARE,
99-
'path' => 'files'
100-
]);
98+
$mask = $share->getPermissions() | Constants::PERMISSION_SHARE;
99+
100+
if ($storage instanceof IHomeStorage) {
101+
return new DirPermissionsMask([
102+
'storage' => $storage,
103+
'mask' => $mask
104+
'path' => 'files'
105+
]);
106+
} else {
107+
return new PermissionsMask(['storage' => $storage, 'mask' => $mask]);
108+
}
101109
});
102110
Filesystem::addStorageWrapper('shareOwner', function ($mountPoint, $storage) use ($share) {
103111
return new PublicOwnerWrapper(['storage' => $storage, 'owner' => $share->getShareOwner()]);

0 commit comments

Comments
 (0)