diff options
Diffstat (limited to 'routers/web/repo')
-rw-r--r-- | routers/web/repo/commit.go | 2 | ||||
-rw-r--r-- | routers/web/repo/issue.go | 9 | ||||
-rw-r--r-- | routers/web/repo/milestone.go | 3 | ||||
-rw-r--r-- | routers/web/repo/search.go | 7 | ||||
-rw-r--r-- | routers/web/repo/topic.go | 2 |
5 files changed, 9 insertions, 14 deletions
diff --git a/routers/web/repo/commit.go b/routers/web/repo/commit.go index 57ee7a2043..6fbf11a1a0 100644 --- a/routers/web/repo/commit.go +++ b/routers/web/repo/commit.go @@ -177,7 +177,7 @@ func SearchCommits(ctx *context.Context) { ctx.Data["PageIsCommits"] = true ctx.Data["PageIsViewCode"] = true - query := strings.Trim(ctx.FormString("q"), " ") + query := ctx.FormTrim("q") if len(query) == 0 { ctx.Redirect(ctx.Repo.RepoLink + "/commits/" + ctx.Repo.BranchNameSubURL()) return diff --git a/routers/web/repo/issue.go b/routers/web/repo/issue.go index 248ae5b132..6050bb5c23 100644 --- a/routers/web/repo/issue.go +++ b/routers/web/repo/issue.go @@ -1722,14 +1722,12 @@ func UpdateIssueContent(ctx *context.Context) { return } - content := ctx.FormString("content") - if err := issue_service.ChangeContent(issue, ctx.User, content); err != nil { + if err := issue_service.ChangeContent(issue, ctx.User, ctx.Req.FormValue("content")); err != nil { ctx.ServerError("ChangeContent", err) return } - files := ctx.FormStrings("files[]") - if err := updateAttachments(issue, files); err != nil { + if err := updateAttachments(issue, ctx.FormStrings("files[]")); err != nil { ctx.ServerError("UpdateAttachments", err) return } @@ -2157,8 +2155,7 @@ func UpdateCommentContent(ctx *context.Context) { return } - files := ctx.FormStrings("files[]") - if err := updateAttachments(comment, files); err != nil { + if err := updateAttachments(comment, ctx.FormStrings("files[]")); err != nil { ctx.ServerError("UpdateAttachments", err) return } diff --git a/routers/web/repo/milestone.go b/routers/web/repo/milestone.go index 675cfef0aa..ca77e0976e 100644 --- a/routers/web/repo/milestone.go +++ b/routers/web/repo/milestone.go @@ -6,7 +6,6 @@ package repo import ( "net/http" - "strings" "time" "code.gitea.io/gitea/models" @@ -47,7 +46,7 @@ func Milestones(ctx *context.Context) { sortType := ctx.FormString("sort") - keyword := strings.Trim(ctx.FormString("q"), " ") + keyword := ctx.FormTrim("q") page := ctx.FormInt("page") if page <= 1 { 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}, diff --git a/routers/web/repo/topic.go b/routers/web/repo/topic.go index 2a2a04c111..41e3f995b6 100644 --- a/routers/web/repo/topic.go +++ b/routers/web/repo/topic.go @@ -23,7 +23,7 @@ func TopicsPost(ctx *context.Context) { } var topics = make([]string, 0) - var topicsStr = strings.TrimSpace(ctx.FormString("topics")) + var topicsStr = ctx.FormTrim("topics") if len(topicsStr) > 0 { topics = strings.Split(topicsStr, ",") } |