1
1
mirror of https://github.com/go-gitea/gitea synced 2025-07-23 02:38:35 +00:00

Related refactors to ctx.FormX functions (#16567)

* use FormTrim if posible

* speedup goGet

* only convert if nessesary
This commit is contained in:
6543
2021-08-11 17:08:52 +02:00
committed by GitHub
parent 2d25b7d44b
commit f1a810e090
22 changed files with 36 additions and 52 deletions

View File

@@ -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},