aboutsummaryrefslogtreecommitdiffstats
path: root/routers/api
diff options
context:
space:
mode:
authorGiteabot <teabot@gitea.io>2023-08-09 15:31:44 +0800
committerGitHub <noreply@github.com>2023-08-09 07:31:44 +0000
commit2d1a7e1cd42b31a62ca627423d088339809238c8 (patch)
tree54ac85a7606d415322b9661ba4d434433f184b4f /routers/api
parentdf5558135b3520ad046588e781a3845b7b4aa24b (diff)
downloadgitea-2d1a7e1cd42b31a62ca627423d088339809238c8.tar.gz
gitea-2d1a7e1cd42b31a62ca627423d088339809238c8.zip
Introduce ctx.PathParamRaw to avoid incorrect unescaping (#26392) (#26405)
Backport #26392 by @wxiaoguang Fix #26389 And complete an old TODO: `ctx.Params does un-escaping,..., which is incorrect.` Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
Diffstat (limited to 'routers/api')
-rw-r--r--routers/api/v1/repo/wiki.go8
1 files changed, 4 insertions, 4 deletions
diff --git a/routers/api/v1/repo/wiki.go b/routers/api/v1/repo/wiki.go
index e33790a378..7f3a7d0674 100644
--- a/routers/api/v1/repo/wiki.go
+++ b/routers/api/v1/repo/wiki.go
@@ -127,7 +127,7 @@ func EditWikiPage(ctx *context.APIContext) {
form := web.GetForm(ctx).(*api.CreateWikiPageOptions)
- oldWikiName := wiki_service.WebPathFromRequest(ctx.Params(":pageName"))
+ oldWikiName := wiki_service.WebPathFromRequest(ctx.PathParamRaw(":pageName"))
newWikiName := wiki_service.UserTitleToWebPath("", form.Title)
if len(newWikiName) == 0 {
@@ -231,7 +231,7 @@ func DeleteWikiPage(ctx *context.APIContext) {
// "404":
// "$ref": "#/responses/notFound"
- wikiName := wiki_service.WebPathFromRequest(ctx.Params(":pageName"))
+ wikiName := wiki_service.WebPathFromRequest(ctx.PathParamRaw(":pageName"))
if err := wiki_service.DeleteWikiPage(ctx, ctx.Doer, ctx.Repo.Repository, wikiName); err != nil {
if err.Error() == "file does not exist" {
@@ -359,7 +359,7 @@ func GetWikiPage(ctx *context.APIContext) {
// "$ref": "#/responses/notFound"
// get requested pagename
- pageName := wiki_service.WebPathFromRequest(ctx.Params(":pageName"))
+ pageName := wiki_service.WebPathFromRequest(ctx.PathParamRaw(":pageName"))
wikiPage := getWikiPage(ctx, pageName)
if !ctx.Written() {
@@ -409,7 +409,7 @@ func ListPageRevisions(ctx *context.APIContext) {
}
// get requested pagename
- pageName := wiki_service.WebPathFromRequest(ctx.Params(":pageName"))
+ pageName := wiki_service.WebPathFromRequest(ctx.PathParamRaw(":pageName"))
if len(pageName) == 0 {
pageName = "Home"
}