aboutsummaryrefslogtreecommitdiffstats
path: root/routers/web/repo/search.go
diff options
context:
space:
mode:
author6543 <6543@obermui.de>2021-08-11 17:08:52 +0200
committerGitHub <noreply@github.com>2021-08-11 18:08:52 +0300
commitf1a810e0901b80eb6bc21103434fc0737af17eaa (patch)
tree9656d780cf19fd745f41eef0012701458aa271c4 /routers/web/repo/search.go
parent2d25b7d44bedf8f17cc2b49f39d1cee662b199a5 (diff)
downloadgitea-f1a810e0901b80eb6bc21103434fc0737af17eaa.tar.gz
gitea-f1a810e0901b80eb6bc21103434fc0737af17eaa.zip
Related refactors to ctx.FormX functions (#16567)
* use FormTrim if posible * speedup goGet * only convert if nessesary
Diffstat (limited to 'routers/web/repo/search.go')
-rw-r--r--routers/web/repo/search.go7
1 files changed, 3 insertions, 4 deletions
diff --git a/routers/web/repo/search.go b/routers/web/repo/search.go
index 02dd257cda..67539c3d7e 100644
--- a/routers/web/repo/search.go
+++ b/routers/web/repo/search.go
@@ -6,7 +6,6 @@ package repo
import (
"net/http"
- "strings"
"code.gitea.io/gitea/modules/base"
"code.gitea.io/gitea/modules/context"
@@ -22,13 +21,13 @@ func Search(ctx *context.Context) {
ctx.Redirect(ctx.Repo.RepoLink, 302)
return
}
- language := strings.TrimSpace(ctx.FormString("l"))
- keyword := strings.TrimSpace(ctx.FormString("q"))
+ language := ctx.FormTrim("l")
+ keyword := ctx.FormTrim("q")
page := ctx.FormInt("page")
if page <= 0 {
page = 1
}
- queryType := strings.TrimSpace(ctx.FormString("t"))
+ queryType := ctx.FormTrim("t")
isMatch := queryType == "match"
total, searchResults, searchResultLanguages, err := code_indexer.PerformSearch([]int64{ctx.Repo.Repository.ID},