Skip to content

Commit ac68e90

Browse files
committed
Escape paths for find file correctly (go-gitea#30026)
1 parent 01f736f commit ac68e90

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

routers/web/repo/find.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import (
88

99
"code.gitea.io/gitea/modules/base"
1010
"code.gitea.io/gitea/modules/context"
11+
"code.gitea.io/gitea/modules/util"
1112
)
1213

1314
const (
@@ -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)