fix: Make sure directories don't get overriden by entries in outline

This commit is contained in:
Dendy 2025-04-14 07:14:23 +02:00
parent 58bafe31f9
commit 7c955c481b
1 changed files with 3 additions and 2 deletions

View File

@ -64,7 +64,6 @@ final class MainController extends AbstractController
foreach ($finder as $file) { foreach ($finder as $file) {
$current = &$tree; $current = &$tree;
// Dunno why it is undefined, it works
foreach (explode('/', $file->getRelativePath()) as $part) { foreach (explode('/', $file->getRelativePath()) as $part) {
if ($part === '') break; if ($part === '') break;
@ -74,7 +73,9 @@ final class MainController extends AbstractController
$current = &$current[$part]; $current = &$current[$part];
} }
$current[$file->getFilenameWithoutExtension()] = []; if (!isset($current[$file->getFilenameWithoutExtension()])) {
$current[$file->getFilenameWithoutExtension()] = [];
}
} }
return $this->render('main/index.html.twig', [ return $this->render('main/index.html.twig', [