Skip to content

Commit d4291fb

Browse files
committed
review fix
1 parent f8560f1 commit d4291fb

File tree

6 files changed

+16
-21
lines changed

6 files changed

+16
-21
lines changed

routers/web/explore/code.go

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ package explore
55

66
import (
77
"net/http"
8-
"net/url"
98

109
repo_model "code.gitea.io/gitea/models/repo"
1110
"code.gitea.io/gitea/modules/base"
@@ -38,9 +37,9 @@ func Code(ctx *context.Context) {
3837
queryType := ctx.FormTrim("t")
3938
isMatch := queryType == "match"
4039

41-
ctx.Data["Keyword"] = url.PathEscape(keyword)
42-
ctx.Data["Language"] = url.PathEscape(language)
43-
ctx.Data["queryType"] = url.PathEscape(queryType)
40+
ctx.Data["Keyword"] = keyword
41+
ctx.Data["Language"] = language
42+
ctx.Data["queryType"] = queryType
4443
ctx.Data["PageIsViewCode"] = true
4544

4645
if keyword == "" {

routers/web/explore/repo.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ func RenderRepoSearch(ctx *context.Context, opts *RepoSearchOptions) {
108108
ctx.Data["TopicOnly"] = topicOnly
109109

110110
language := ctx.FormTrim("language")
111-
ctx.Data["Language"] = url.PathEscape(language)
111+
ctx.Data["Language"] = url.QueryEscape(language)
112112

113113
archived := ctx.FormOptionalBool("archived")
114114
ctx.Data["IsArchived"] = archived
@@ -163,7 +163,7 @@ func RenderRepoSearch(ctx *context.Context, opts *RepoSearchOptions) {
163163
return
164164
}
165165

166-
ctx.Data["Keyword"] = url.PathEscape(keyword)
166+
ctx.Data["Keyword"] = keyword
167167
ctx.Data["Total"] = count
168168
ctx.Data["Repos"] = repos
169169
ctx.Data["IsRepoIndexerEnabled"] = setting.Indexer.RepoIndexerEnabled

routers/web/org/home.go

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ package org
55

66
import (
77
"net/http"
8-
"net/url"
98
"path"
109
"strings"
1110

@@ -48,7 +47,7 @@ func Home(ctx *context.Context) {
4847
ctx.Data["Title"] = org.DisplayName()
4948

5049
var orderBy db.SearchOrderBy
51-
ctx.Data["SortType"] = url.PathEscape(ctx.FormString("sort"))
50+
ctx.Data["SortType"] = ctx.FormString("sort")
5251
switch ctx.FormString("sort") {
5352
case "newest":
5453
orderBy = db.SearchOrderByNewest
@@ -76,10 +75,10 @@ func Home(ctx *context.Context) {
7675
}
7776

7877
keyword := ctx.FormTrim("q")
79-
ctx.Data["Keyword"] = url.PathEscape(keyword)
78+
ctx.Data["Keyword"] = keyword
8079

8180
language := ctx.FormTrim("language")
82-
ctx.Data["Language"] = url.PathEscape(language)
81+
ctx.Data["Language"] = language
8382

8483
page := ctx.FormInt("page")
8584
if page <= 0 {

routers/web/repo/search.go

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ package repo
55

66
import (
77
"net/http"
8-
"net/url"
98

109
"code.gitea.io/gitea/modules/base"
1110
"code.gitea.io/gitea/modules/context"
@@ -28,9 +27,9 @@ func Search(ctx *context.Context) {
2827
queryType := ctx.FormTrim("t")
2928
isMatch := queryType == "match"
3029

31-
ctx.Data["Keyword"] = url.PathEscape(keyword)
32-
ctx.Data["Language"] = url.PathEscape(language)
33-
ctx.Data["queryType"] = url.PathEscape(queryType)
30+
ctx.Data["Keyword"] = keyword
31+
ctx.Data["Language"] = language
32+
ctx.Data["queryType"] = queryType
3433
ctx.Data["PageIsViewCode"] = true
3534

3635
if keyword == "" {

routers/web/user/code.go

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ package user
55

66
import (
77
"net/http"
8-
"net/url"
98

109
repo_model "code.gitea.io/gitea/models/repo"
1110
"code.gitea.io/gitea/modules/base"
@@ -43,9 +42,9 @@ func CodeSearch(ctx *context.Context) {
4342
queryType := ctx.FormTrim("t")
4443
isMatch := queryType == "match"
4544

46-
ctx.Data["Keyword"] = url.PathEscape(keyword)
47-
ctx.Data["Language"] = url.PathEscape(language)
48-
ctx.Data["queryType"] = url.PathEscape(queryType)
45+
ctx.Data["Keyword"] = keyword
46+
ctx.Data["Language"] = language
47+
ctx.Data["queryType"] = queryType
4948
ctx.Data["IsCodePage"] = true
5049

5150
if keyword == "" {

routers/web/user/profile.go

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ package user
77
import (
88
"fmt"
99
"net/http"
10-
"net/url"
1110
"path"
1211
"strings"
1312

@@ -138,10 +137,10 @@ func prepareUserProfileTabData(ctx *context.Context, showPrivate bool, profileDb
138137
}
139138

140139
keyword := ctx.FormTrim("q")
141-
ctx.Data["Keyword"] = url.PathEscape(keyword)
140+
ctx.Data["Keyword"] = keyword
142141

143142
language := ctx.FormTrim("language")
144-
ctx.Data["Language"] = url.PathEscape(language)
143+
ctx.Data["Language"] = language
145144

146145
followers, numFollowers, err := user_model.GetUserFollowers(ctx, ctx.ContextUser, ctx.Doer, db.ListOptions{
147146
PageSize: pagingNum,

0 commit comments

Comments
 (0)