diff options
author | Bo-Yi Wu <appleboy.tw@gmail.com> | 2017-02-11 12:00:01 +0800 |
---|---|---|
committer | Lunny Xiao <xiaolunwen@gmail.com> | 2017-02-11 12:00:01 +0800 |
commit | 3576e1ee739cc03f87e6ce98dbef2f32b517b202 (patch) | |
tree | 7eed6fa0e5bd1889807d0754b6767237b7964a5b /routers/repo | |
parent | 55f2059f711268958c2f762934039594ebfa7e56 (diff) | |
download | gitea-3576e1ee739cc03f87e6ce98dbef2f32b517b202.tar.gz gitea-3576e1ee739cc03f87e6ce98dbef2f32b517b202.zip |
fix: trim the whitespaces for the search keyword (#893)
Diffstat (limited to 'routers/repo')
-rw-r--r-- | routers/repo/commit.go | 3 | ||||
-rw-r--r-- | routers/repo/issue.go | 2 |
2 files changed, 3 insertions, 2 deletions
diff --git a/routers/repo/commit.go b/routers/repo/commit.go index f165ed8525..37e57ac06f 100644 --- a/routers/repo/commit.go +++ b/routers/repo/commit.go @@ -7,6 +7,7 @@ package repo import ( "container/list" "path" + "strings" "code.gitea.io/git" "code.gitea.io/gitea/models" @@ -106,7 +107,7 @@ func Graph(ctx *context.Context) { func SearchCommits(ctx *context.Context) { ctx.Data["PageIsCommits"] = true - keyword := ctx.Query("q") + keyword := strings.Trim(ctx.Query("q"), " ") if len(keyword) == 0 { ctx.Redirect(ctx.Repo.RepoLink + "/commits/" + ctx.Repo.BranchName) return diff --git a/routers/repo/issue.go b/routers/repo/issue.go index bc9e72a1ac..17c3b56c2e 100644 --- a/routers/repo/issue.go +++ b/routers/repo/issue.go @@ -145,7 +145,7 @@ func Issues(ctx *context.Context) { milestoneID := ctx.QueryInt64("milestone") isShowClosed := ctx.Query("state") == "closed" - keyword := ctx.Query("q") + keyword := strings.Trim(ctx.Query("q"), " ") if bytes.Contains([]byte(keyword), []byte{0x00}) { keyword = "" } |