Skip to content

Commit

Permalink
Merge pull request #31610 from nextcloud/shares-in-folder-mounts
Browse files Browse the repository at this point in the history
fix shared mount roots not being returned from `getSharesInFolder`
  • Loading branch information
PVince81 authored Apr 11, 2022
2 parents cde2605 + e83ad8c commit 0b8582f
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion lib/private/Share20/DefaultShareProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -670,8 +670,21 @@ public function getSharesInFolder($userId, Folder $node, $reshares) {
);
}

// todo? maybe get these from the oc_mounts table
$childMountNodes = array_filter($node->getDirectoryListing(), function (Node $node) {
return $node->getInternalPath() === '';
});
$childMountRootIds = array_map(function (Node $node) {
return $node->getId();
}, $childMountNodes);

$qb->innerJoin('s', 'filecache', 'f', $qb->expr()->eq('s.file_source', 'f.fileid'));
$qb->andWhere($qb->expr()->eq('f.parent', $qb->createNamedParameter($node->getId())));
$qb->andWhere(
$qb->expr()->orX(
$qb->expr()->eq('f.parent', $qb->createNamedParameter($node->getId())),
$qb->expr()->in('f.fileid', $qb->createNamedParameter($childMountRootIds, IQueryBuilder::PARAM_INT_ARRAY))
)
);

$qb->orderBy('id');

Expand Down

0 comments on commit 0b8582f

Please sign in to comment.