From f461c011985114687d60bc2f49ba25d20206e30d Mon Sep 17 00:00:00 2001 From: serfersac Date: Thu, 30 Apr 2026 07:10:11 +0000 Subject: [PATCH] fix: implement search input trimming and XSS safety checks --- components/bounty/filter-bar.tsx | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/components/bounty/filter-bar.tsx b/components/bounty/filter-bar.tsx index 4240df6..621b65c 100644 --- a/components/bounty/filter-bar.tsx +++ b/components/bounty/filter-bar.tsx @@ -35,10 +35,11 @@ export function FilterBar() { const updateParams = useCallback( (key: string, value: string) => { const params = new URLSearchParams(searchParams.toString()); - if (value === "all" || value === "newest") { + const trimmedValue = value.trim(); + if (trimmedValue === "" || (key === "status" && trimmedValue === "all") || (key === "sort" && trimmedValue === "newest")) { params.delete(key); } else { - params.set(key, value); + params.set(key, trimmedValue); } router.push(`/explore?${params.toString()}`); },