From 7a5a8392c7a662116a85d43bfe6d3e9248a94e43 Mon Sep 17 00:00:00 2001 From: rramiachraf <51409801+rramiachraf@users.noreply.github.com> Date: Mon, 13 Mar 2023 20:18:43 +0100 Subject: [PATCH] fix: escape query on search --- search.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/search.go b/search.go index a1b0ec1..1392e8d 100644 --- a/search.go +++ b/search.go @@ -4,6 +4,7 @@ import ( "encoding/json" "fmt" "net/http" + "net/url" ) type response struct { @@ -35,7 +36,7 @@ type renderVars struct { func searchHandler(w http.ResponseWriter, r *http.Request) { query := r.URL.Query().Get("q") - url := fmt.Sprintf(`https://genius.com/api/search/multi?q=%s`, query) + url := fmt.Sprintf(`https://genius.com/api/search/multi?q=%s`, url.QueryEscape(query)) res, err := sendRequest(url) if err != nil {