Skip to content

Commit 1cdc6c3

Browse files
authored
Escape paths for find file correctly (go-gitea#30026)
Fix go-gitea#30020
1 parent 74c1378 commit 1cdc6c3

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

routers/web/repo/find.go

+3-2
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import (
77
"net/http"
88

99
"code.gitea.io/gitea/modules/base"
10+
"code.gitea.io/gitea/modules/util"
1011
"code.gitea.io/gitea/services/context"
1112
)
1213

@@ -17,7 +18,7 @@ const (
1718
// FindFiles render the page to find repository files
1819
func FindFiles(ctx *context.Context) {
1920
path := ctx.Params("*")
20-
ctx.Data["TreeLink"] = ctx.Repo.RepoLink + "/src/" + path
21-
ctx.Data["DataLink"] = ctx.Repo.RepoLink + "/tree-list/" + path
21+
ctx.Data["TreeLink"] = ctx.Repo.RepoLink + "/src/" + util.PathEscapeSegments(path)
22+
ctx.Data["DataLink"] = ctx.Repo.RepoLink + "/tree-list/" + util.PathEscapeSegments(path)
2223
ctx.HTML(http.StatusOK, tplFindFiles)
2324
}

0 commit comments

Comments
 (0)