evaluator: urlencode query
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
Simon Bruder 2019-06-12 11:49:00 +00:00
parent 6029bc2882
commit 9da7ed74c2
No known key found for this signature in database
GPG key ID: 6F03E0000CC5B62F

View file

@ -1,12 +1,13 @@
package main
import (
"net/http"
"log"
"strings"
"encoding/json"
"io/ioutil"
"log"
"net/http"
"net/url"
"regexp"
"strings"
)
var bangs = loadBangs()
@ -45,7 +46,7 @@ func loadBangs() (bangs map[string]string) {
}
func buildSearchURL(template string, query string) (searchUrl string) {
return strings.Replace(template, "%s", query, 1)
return strings.Replace(template, "%s", url.QueryEscape(query), 1)
}
func parseBang(searchQuery string) (bang string, query string) {