From 9da7ed74c26f33818a4984a769e723d1d8393f60 Mon Sep 17 00:00:00 2001 From: Simon Bruder Date: Wed, 12 Jun 2019 11:49:00 +0000 Subject: [PATCH] evaluator: urlencode query --- evaluator/evaluator.go | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/evaluator/evaluator.go b/evaluator/evaluator.go index c4c8e56..6dc5b56 100644 --- a/evaluator/evaluator.go +++ b/evaluator/evaluator.go @@ -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) {