evaluator: urlencode query
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
parent
6029bc2882
commit
9da7ed74c2
|
@ -1,12 +1,13 @@
|
||||||
package main
|
package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"net/http"
|
|
||||||
"log"
|
|
||||||
"strings"
|
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"io/ioutil"
|
"io/ioutil"
|
||||||
|
"log"
|
||||||
|
"net/http"
|
||||||
|
"net/url"
|
||||||
"regexp"
|
"regexp"
|
||||||
|
"strings"
|
||||||
)
|
)
|
||||||
|
|
||||||
var bangs = loadBangs()
|
var bangs = loadBangs()
|
||||||
|
@ -45,7 +46,7 @@ func loadBangs() (bangs map[string]string) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func buildSearchURL(template string, query string) (searchUrl 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) {
|
func parseBang(searchQuery string) (bang string, query string) {
|
||||||
|
|
Loading…
Reference in a new issue