]> source.dussan.org Git - nextcloud-server.git/commitdiff
fix shared mount roots not being returned from `getSharesInFolder` 31610/head
authorRobin Appelman <robin@icewind.nl>
Thu, 17 Mar 2022 16:19:24 +0000 (17:19 +0100)
committerRobin Appelman <robin@icewind.nl>
Thu, 31 Mar 2022 15:25:56 +0000 (17:25 +0200)
Signed-off-by: Robin Appelman <robin@icewind.nl>
lib/private/Share20/DefaultShareProvider.php

index 6e8d9105a76920bfb5a1e298f300a64d46da25a5..9638706025bd0a2e04fbbedfd8096dd91e0744b6 100644 (file)
@@ -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');