Skip to content

Commit d4b1d2f

Browse files
SystemKeeperbackportbot[bot]
authored andcommitted
fix(dav): Ensure we access a shareable node if multiple exist
Signed-off-by: Marcel Müller <marcel-mueller@gmx.de>
1 parent 85fccc8 commit d4b1d2f

2 files changed

Lines changed: 22 additions & 0 deletions

File tree

apps/dav/appinfo/v1/publicwebdav.php

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,17 @@ function (\Sabre\DAV\Server $server) use (
110110
if (!$node) {
111111
throw new \Sabre\DAV\Exception\NotFound();
112112
}
113+
114+
// getFirstNodeById might return a node without share permission -> try to find a node which is shareable
115+
if (!$node->isShareable()) {
116+
foreach ($userFolder->getById($fileId) as $candidate) {
117+
if ($candidate->isShareable()) {
118+
$node = $candidate;
119+
break;
120+
}
121+
}
122+
}
123+
113124
$linkCheckPlugin->setFileInfo($node);
114125

115126
// If not readable (files_drop) enable the filesdrop plugin

apps/dav/appinfo/v2/publicremote.php

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -144,6 +144,17 @@
144144
if (!$node) {
145145
throw new NotFound();
146146
}
147+
148+
// getFirstNodeById might return a node without share permission -> try to find a node which is shareable
149+
if (!$node->isShareable()) {
150+
foreach ($userFolder->getById($fileId) as $candidate) {
151+
if ($candidate->isShareable()) {
152+
$node = $candidate;
153+
break;
154+
}
155+
}
156+
}
157+
147158
$linkCheckPlugin->setFileInfo($node);
148159

149160
// If not readable (files_drop) enable the filesdrop plugin

0 commit comments

Comments
 (0)