From 6b56293ca79393265fbb985d236604e64125109e Mon Sep 17 00:00:00 2001 From: David Lin <13061926+davidlhw@users.noreply.github.com> Date: Sun, 15 Dec 2024 04:16:50 +0800 Subject: [PATCH] fix: trim leading and trailing spaces from search terms --- src/modules/search/functions/processSearchQuery.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/modules/search/functions/processSearchQuery.ts b/src/modules/search/functions/processSearchQuery.ts index bcbe2a75..e1f1dd17 100644 --- a/src/modules/search/functions/processSearchQuery.ts +++ b/src/modules/search/functions/processSearchQuery.ts @@ -1,3 +1,5 @@ export function processSearchQuery(query: string): string { - return query.trim().includes(" ") ? query.split(" ").join(" & ") : query; + const cleanedQuery = query.trim() + + return cleanedQuery.includes(" ") ? cleanedQuery.split(" ").join(" & ") : query; }