diff options
Diffstat (limited to 'routes')
-rw-r--r-- | routes/repo/editor.go | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/routes/repo/editor.go b/routes/repo/editor.go index 4cd78d70..03f30bdc 100644 --- a/routes/repo/editor.go +++ b/routes/repo/editor.go @@ -140,7 +140,7 @@ func editFilePost(c *context.Context, f form.EditRepoFile, isNewFile bool) { branchName = f.NewBranchName } - f.TreePath = strings.Trim(f.TreePath, " /") + f.TreePath = strings.Trim(path.Clean("/"+f.TreePath), " /") treeNames, treePaths := getParentTreeFields(f.TreePath) c.Data["ParentTreePath"] = path.Dir(c.Repo.TreePath) @@ -431,7 +431,7 @@ func UploadFilePost(c *context.Context, f form.UploadRepoFile) { branchName = f.NewBranchName } - f.TreePath = strings.Trim(f.TreePath, " /") + f.TreePath = strings.Trim(path.Clean("/"+f.TreePath), " /") treeNames, treePaths := getParentTreeFields(f.TreePath) if len(treeNames) == 0 { // We must at least have one element for user to input. |