Skip to content

Commit 6c20f22

Browse files
baidu: 对要查询的内容进行URI编码 (#866)
1 parent 6f2c9f7 commit 6c20f22

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

plugin/baidu/search.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ package baidu
44
import (
55
"encoding/json"
66
"fmt"
7+
"net/url"
78

89
"github.com/FloatTech/floatbox/web"
910
ctrl "github.com/FloatTech/zbpctrl"
@@ -37,9 +38,9 @@ func init() { // 主函数
3738
var err error
3839
switch ctx.State["regex_matched"].([]string)[1] {
3940
case "百度", "百科":
40-
es, err = web.GetData(fmt.Sprintf(duURL, key, ctx.State["regex_matched"].([]string)[2])) // 将网站返回结果赋值
41+
es, err = web.GetData(fmt.Sprintf(duURL, key, url.QueryEscape(ctx.State["regex_matched"].([]string)[2]))) // 将网站返回结果赋值
4142
case "wiki", "维基":
42-
es, err = web.GetData(fmt.Sprintf(wikiURL, key, ctx.State["regex_matched"].([]string)[2])) // 将网站返回结果赋值
43+
es, err = web.GetData(fmt.Sprintf(wikiURL, key, url.QueryEscape(ctx.State["regex_matched"].([]string)[2]))) // 将网站返回结果赋值
4344
}
4445
if err != nil {
4546
ctx.SendChain(message.Text("出现错误捏:", err))

0 commit comments

Comments
 (0)