aboutsummaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorRobin Appelman <robin@icewind.nl>2023-05-10 15:20:56 +0200
committerRobin Appelman <robin@icewind.nl>2023-07-28 14:57:06 +0200
commit2fe6370923cb4b052d7472681a2c6a254f4c6892 (patch)
tree4be61d25f5da1e6a07f13624348d5780b0d06cff /lib
parent6d9cf9e2996ee3ffcd9eba824df3d1557f1b8f3f (diff)
downloadnextcloud-server-2fe6370923cb4b052d7472681a2c6a254f4c6892.tar.gz
nextcloud-server-2fe6370923cb4b052d7472681a2c6a254f4c6892.zip
fix share roots always being marked as writable
Signed-off-by: Robin Appelman <robin@icewind.nl>
Diffstat (limited to 'lib')
-rw-r--r--lib/public/Files/DavUtil.php18
1 files changed, 16 insertions, 2 deletions
diff --git a/lib/public/Files/DavUtil.php b/lib/public/Files/DavUtil.php
index 343f3c2ac0f..2e7efdccd07 100644
--- a/lib/public/Files/DavUtil.php
+++ b/lib/public/Files/DavUtil.php
@@ -32,6 +32,9 @@
namespace OCP\Files;
+use OCP\Constants;
+use OC\Files\Mount\MoveableMount;
+
/**
* This class provides different helper functions related to WebDAV protocol
*
@@ -73,10 +76,21 @@ class DavUtil {
$p .= 'D';
}
if ($info->isUpdateable()) {
- $p .= 'NV'; // Renameable, Moveable
+ $p .= 'NV'; // Renameable, Movable
}
+
+ // since we always add update permissions for the root of movable mounts
+ // we need to check the shared cache item directly to determine if it's writable
+ $storage = $info->getStorage();
+ if ($info->getInternalPath() === '' && $info->getMountPoint() instanceof MoveableMount) {
+ $rootEntry = $storage->getCache()->get('');
+ $isWritable = $rootEntry->getPermissions() & Constants::PERMISSION_UPDATE;
+ } else {
+ $isWritable = $info->isUpdateable();
+ }
+
if ($info->getType() === FileInfo::TYPE_FILE) {
- if ($info->isUpdateable()) {
+ if ($isWritable) {
$p .= 'W';
}
} else {