From 8b4e9c4dffdd57d47a2075653b1ab53a4b367e04 Mon Sep 17 00:00:00 2001 From: Chris Kankiewicz Date: Wed, 19 Mar 2025 11:02:12 -0700 Subject: [PATCH] Fixed search not respecting the FILES_DIR path --- app/src/Controllers/SearchController.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/app/src/Controllers/SearchController.php b/app/src/Controllers/SearchController.php index d96a8ce..4414de3 100644 --- a/app/src/Controllers/SearchController.php +++ b/app/src/Controllers/SearchController.php @@ -4,6 +4,7 @@ declare(strict_types=1); namespace App\Controllers; +use DI\Container; use Psr\Http\Message\ResponseInterface; use Slim\Psr7\Request; use Slim\Psr7\Response; @@ -14,6 +15,7 @@ use Symfony\Contracts\Translation\TranslatorInterface; class SearchController { public function __construct( + private Container $container, private Finder $finder, private Twig $view, private TranslatorInterface $translator @@ -23,7 +25,7 @@ class SearchController { $search = $request->getQueryParams()['search']; - $files = $this->finder->in('.')->name( + $files = $this->finder->in($this->container->call('full_path', ['path' => '.']))->name( $search ? sprintf('/(?:.*)%s(?:.*)/i', preg_quote($search, '/')) : '' );