aboutsummaryrefslogtreecommitdiffstats
path: root/apps/files_sharing/publicwebdav.php
diff options
context:
space:
mode:
Diffstat (limited to 'apps/files_sharing/publicwebdav.php')
-rw-r--r--apps/files_sharing/publicwebdav.php8
1 files changed, 8 insertions, 0 deletions
diff --git a/apps/files_sharing/publicwebdav.php b/apps/files_sharing/publicwebdav.php
index b4f56eed89c..f33b920bc54 100644
--- a/apps/files_sharing/publicwebdav.php
+++ b/apps/files_sharing/publicwebdav.php
@@ -37,7 +37,15 @@ $server->addPlugin(new OC_Connector_Sabre_ExceptionLoggerPlugin('webdav'));
$server->subscribeEvent('beforeMethod', function () use ($server, $objectTree, $authBackend) {
$share = $authBackend->getShare();
$owner = $share['uid_owner'];
+ $isWritable = $share['permissions'];
$fileId = $share['file_source'];
+
+ if (!$isWritable) {
+ \OC\Files\Filesystem::addStorageWrapper('readonly', function ($mountPoint, $storage) {
+ return new \OCA\Files_Sharing\ReadOnlyWrapper(array('storage' => $storage));
+ });
+ }
+
OC_Util::setupFS($owner);
$ownerView = \OC\Files\Filesystem::getView();
$path = $ownerView->getPath($fileId);