From d7d956384aff32db4f4ce5d38902c3b7f335df0b Mon Sep 17 00:00:00 2001 From: Stefan Hagspiel Date: Mon, 17 Aug 2026 14:09:05 +0200 Subject: [PATCH] fix: handle root path in optimizedConcatNotLike --- src/Helper/GridHelperService.php | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/Helper/GridHelperService.php b/src/Helper/GridHelperService.php index 36cc84ae..3a40d64e 100644 --- a/src/Helper/GridHelperService.php +++ b/src/Helper/GridHelperService.php @@ -1013,6 +1013,14 @@ private function optimizedConcatNotLike( $path = implode('/', $pathParts); $queryColumn = $type === 'asset' ? '`filename`' : '`key`'; + //special case for the root folder: "/" is the whole tree, so excluding it excludes everything. + //Only the root row itself is left over when its children are excluded, and that is the one row with an empty key. + if ($fullpath === '/') { + return $onlyChildren + ? '(`path` = "/" AND ' . $queryColumn . ' = "")' + : '1 = 0'; + } + if ($onlyChildren) { return '`path` NOT LIKE "' . $fullpath . '/%"'; }