From 94df3babe33385457dba9581eeb7ce0750bbb1b7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Do=C4=9Fukan=20=C3=9Crker?= Date: Wed, 17 Jan 2024 16:47:14 +0300 Subject: [PATCH] Update searchBar.js --- static/tailwindUI/js/searchBar.js | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/static/tailwindUI/js/searchBar.js b/static/tailwindUI/js/searchBar.js index b2e966fc..2cb8bc86 100644 --- a/static/tailwindUI/js/searchBar.js +++ b/static/tailwindUI/js/searchBar.js @@ -1,8 +1,9 @@ function searchBar() { - var input = document.querySelector("#searchBarInput").value; - console.log(input); - if (input === "" || input.replace(/\s/g, "") === "") { + const input = document.querySelector("#searchBarInput").value; + if (input === "" || input.trim() === "") { } else { - window.location.href = `/search/${input.replace(/\s/g, "+")}`; + window.location.href = `/search/${encodeURIComponent( + escape(input.trim()) + )}`; } }