Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 7 additions & 3 deletions lib/Db/ShareWrapperRequest.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
use OCP\Share\Exceptions\IllegalIDChangeException;
use OCP\Share\IAttributes;
use OCP\Share\IShare;
use function strlen;

/**
* Class ShareWrapperRequest
Expand Down Expand Up @@ -383,10 +384,13 @@ public function getSharedWithByPath(
$qb->limitNull('parent', false);
$childAlias = $qb->leftJoinShareChild(CoreQueryBuilder::SHARE);

$userId = $federatedUser->getUserId();
if (str_starts_with($path, '/' . $userId . '/files')) {
$path = substr($path, strlen('/' . $userId . '/files'));
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See my comment on the server PR

$path = rtrim($path, '/');

if ($forChildren) {
$userId = $federatedUser->getUserId();
$path = str_replace('/' . $userId . '/files', '', $path);
$path = rtrim($path, '/');
$childPathTemplate = $this->getQueryBuilder()->getConnection()->escapeLikeParameter($path) . '/_%';

$qb->limitToFileTargetLike($childPathTemplate, $childAlias);
Expand Down
Loading