fix(external-storage): Rtrim trailing slash at the end

Otherwise we don't have any matches when $forChildren is false

Signed-off-by: Carl Schwan <carlschwan@kde.org>
This commit is contained in:
Carl Schwan 2026-01-30 15:49:12 +01:00
parent f61ef6d7e6
commit 761a6979a7
No known key found for this signature in database
GPG key ID: 02325448204E452A
2 changed files with 2 additions and 1 deletions

View file

@ -120,6 +120,7 @@ class DBConfigService {
*/
public function getMountsForUserAndPath(string $userId, array $groupIds, string $path, bool $forChildren): array {
$path = str_replace('/' . $userId . '/files', '', $path);
$path = rtrim($path, '/');
$builder = $this->getSelectQueryBuilder();
$builder->where($builder->expr()->orX(
$builder->expr()->andX( // global mounts

View file

@ -214,7 +214,7 @@ class ConfigAdapterTest extends TestCase {
public function testPartialMountpointExact(): void {
$mountFileInfo = $this->createMock(ICachedMountFileInfo::class);
$mountFileInfo->method('getUser')->willReturn($this->user);
$mountFileInfo->method('getMountPoint')->willReturn('/user1/files/subfolder/subfolder');
$mountFileInfo->method('getMountPoint')->willReturn('/user1/files/subfolder/subfolder/');
$cacheEntry = $this->createMock(ICacheEntry::class);
$result = $this->adapter->getMountsForPath('/user1/files/subfolder/subfolder', true, [