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

Skip to content

Commit 0fc87a5

Browse files
committed
tag filter
1 parent e4ff191 commit 0fc87a5

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

http/controller/search.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ package controller
22

33
import (
44
"html"
5+
"net/http"
56

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

56+
// 过滤非法 tag
57+
if len(q) > 9 {
58+
return ctx.Redirect(http.StatusSeeOther, "/")
59+
}
60+
5561
rows := 50
5662

5763
respBody, err := logic.DefaultSearcher.DoSearch(q, field, (p-1)*rows, rows)

http/controller/wechat.go

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77
package controller
88

99
import (
10-
"fmt"
1110
"io/ioutil"
1211
"net/http"
1312

@@ -62,7 +61,6 @@ func (self WechatController) Bind(ctx echo.Context) error {
6261
}
6362
err := logic.DefaultWechat.CheckCaptchaAndBind(echoCtx, me, captcha)
6463
if err != nil {
65-
fmt.Println("controller====", err)
6664
return fail(ctx, 2, "验证码错误,请确认获取了或没填错!")
6765
}
6866

0 commit comments

Comments
 (0)