fix: escape query on search
This commit is contained in:
parent
b97a09da37
commit
7a5a8392c7
@ -4,6 +4,7 @@ import (
|
|||||||
"encoding/json"
|
"encoding/json"
|
||||||
"fmt"
|
"fmt"
|
||||||
"net/http"
|
"net/http"
|
||||||
|
"net/url"
|
||||||
)
|
)
|
||||||
|
|
||||||
type response struct {
|
type response struct {
|
||||||
@ -35,7 +36,7 @@ type renderVars struct {
|
|||||||
|
|
||||||
func searchHandler(w http.ResponseWriter, r *http.Request) {
|
func searchHandler(w http.ResponseWriter, r *http.Request) {
|
||||||
query := r.URL.Query().Get("q")
|
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)
|
res, err := sendRequest(url)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user