From c8209fcbe357d4995c9a5209d68ca279df6b1a1c Mon Sep 17 00:00:00 2001 From: Jade Geels Date: Mon, 9 Feb 2026 12:08:13 +0100 Subject: [PATCH 1/3] Fix backend error when search query is longer than 255 characters --- src/Http/Controllers/SearchController.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/Http/Controllers/SearchController.php b/src/Http/Controllers/SearchController.php index 5184a01b1..98e1577e8 100644 --- a/src/Http/Controllers/SearchController.php +++ b/src/Http/Controllers/SearchController.php @@ -9,6 +9,8 @@ class SearchController { public function __invoke(Request $request) { + $request->validate(['q' => 'required|string|max:255']); + $searchQuery = config('rapidez.models.search_query')::firstOrNew([ 'query_text' => Str::lower($request->q), 'store_id' => config('rapidez.store'), From 581622dc4b1e7ecdfdc5d7d53b8eec72ae89c66f Mon Sep 17 00:00:00 2001 From: Jade-GG Date: Mon, 9 Feb 2026 11:08:33 +0000 Subject: [PATCH 2/3] Apply fixes from Duster --- src/Http/Controllers/SearchController.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Http/Controllers/SearchController.php b/src/Http/Controllers/SearchController.php index 98e1577e8..b584f7d53 100644 --- a/src/Http/Controllers/SearchController.php +++ b/src/Http/Controllers/SearchController.php @@ -10,7 +10,7 @@ class SearchController public function __invoke(Request $request) { $request->validate(['q' => 'required|string|max:255']); - + $searchQuery = config('rapidez.models.search_query')::firstOrNew([ 'query_text' => Str::lower($request->q), 'store_id' => config('rapidez.store'), From 59681c9cb9873308563bf220aa10188a44310d95 Mon Sep 17 00:00:00 2001 From: Jade Date: Wed, 11 Feb 2026 11:39:31 +0100 Subject: [PATCH 3/3] Don't error out on search page --- src/Http/Controllers/SearchController.php | 29 +++++++++++++---------- 1 file changed, 17 insertions(+), 12 deletions(-) diff --git a/src/Http/Controllers/SearchController.php b/src/Http/Controllers/SearchController.php index b584f7d53..6014f1637 100644 --- a/src/Http/Controllers/SearchController.php +++ b/src/Http/Controllers/SearchController.php @@ -4,28 +4,33 @@ use Illuminate\Http\Request; use Illuminate\Support\Str; +use Illuminate\Validation\ValidationException; class SearchController { public function __invoke(Request $request) { - $request->validate(['q' => 'required|string|max:255']); + try { + $request->validate(['q' => 'required|string|max:255']); - $searchQuery = config('rapidez.models.search_query')::firstOrNew([ - 'query_text' => Str::lower($request->q), - 'store_id' => config('rapidez.store'), - ], ['popularity' => 1]); + $searchQuery = config('rapidez.models.search_query')::firstOrNew([ + 'query_text' => Str::lower($request->q), + 'store_id' => config('rapidez.store'), + ], ['popularity' => 1]); - if (! $searchQuery->exists) { - $searchQuery->save(); + if (! $searchQuery->exists) { + $searchQuery->save(); - return view('rapidez::search.overview'); - } + return view('rapidez::search.overview'); + } - $searchQuery->increment('popularity'); + $searchQuery->increment('popularity'); - if ($searchQuery->is_active === 1 && $searchQuery->redirect) { - return redirect($searchQuery->redirect, 301); + if ($searchQuery->is_active === 1 && $searchQuery->redirect) { + return redirect($searchQuery->redirect, 301); + } + } catch (ValidationException $e) { + // } return view('rapidez::search.overview');