Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 549171d

Browse files
committed
做 url decode
1 parent 0fc87a5 commit 549171d

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

http/controller/search.go

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ package controller
33
import (
44
"html"
55
"net/http"
6+
"net/url"
67

78
"github.com/studygolang/studygolang/context"
89
"github.com/studygolang/studygolang/logic"
@@ -53,6 +54,12 @@ func (SearchController) TagList(ctx echo.Context) error {
5354
return render(ctx, "notfound", nil)
5455
}
5556

57+
var err error
58+
q, err = url.QueryUnescape(q)
59+
if err != nil {
60+
return ctx.Redirect(http.StatusSeeOther, "/")
61+
}
62+
5663
// 过滤非法 tag
5764
if len(q) > 9 {
5865
return ctx.Redirect(http.StatusSeeOther, "/")

0 commit comments

Comments
 (0)