From e83ad8cfad0c6bcbe8f633c362e2e136d765c499 Mon Sep 17 00:00:00 2001 From: Robin Appelman Date: Thu, 17 Mar 2022 17:19:24 +0100 Subject: [PATCH] fix shared mount roots not being returned from `getSharesInFolder` Signed-off-by: Robin Appelman --- lib/private/Share20/DefaultShareProvider.php | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/lib/private/Share20/DefaultShareProvider.php b/lib/private/Share20/DefaultShareProvider.php index 6e8d9105a76..9638706025b 100644 --- a/lib/private/Share20/DefaultShareProvider.php +++ b/lib/private/Share20/DefaultShareProvider.php @@ -670,8 +670,21 @@ class DefaultShareProvider implements IShareProvider { ); } + // 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'); -- 2.39.5