summaryrefslogtreecommitdiffstats
path: root/routers
diff options
context:
space:
mode:
authorLauris BH <lauris@nix.lv>2018-05-01 04:46:04 +0300
committerBo-Yi Wu <appleboy.tw@gmail.com>2018-05-01 09:46:04 +0800
commit181b3a8f0988ab729270279e6e12534cb52628cc (patch)
tree33ddb166d5284c1d82b765c28634f6ba42bf3b13 /routers
parentfff022ef8a924705e3fd0250aea740292ffd6552 (diff)
downloadgitea-181b3a8f0988ab729270279e6e12534cb52628cc.tar.gz
gitea-181b3a8f0988ab729270279e6e12534cb52628cc.zip
Fix path cleanup in multiple places (#3871)
Diffstat (limited to 'routers')
-rw-r--r--routers/repo/editor.go4
1 files changed, 2 insertions, 2 deletions
diff --git a/routers/repo/editor.go b/routers/repo/editor.go
index 6c6bf304fc..d36bcc4c36 100644
--- a/routers/repo/editor.go
+++ b/routers/repo/editor.go
@@ -163,7 +163,7 @@ func editFilePost(ctx *context.Context, form auth.EditRepoFileForm, isNewFile bo
branchName = form.NewBranchName
}
- form.TreePath = strings.Trim(form.TreePath, " /")
+ form.TreePath = strings.Trim(path.Clean("/"+form.TreePath), " /")
treeNames, treePaths := getParentTreeFields(form.TreePath)
ctx.Data["TreePath"] = form.TreePath
@@ -477,7 +477,7 @@ func UploadFilePost(ctx *context.Context, form auth.UploadRepoFileForm) {
branchName = form.NewBranchName
}
- form.TreePath = strings.Trim(form.TreePath, " /")
+ form.TreePath = strings.Trim(path.Clean("/"+form.TreePath), " /")
treeNames, treePaths := getParentTreeFields(form.TreePath)
if len(treeNames) == 0 {
// We must at least have one element for user to input.