mirror of
https://github.com/go-gitea/gitea
synced 2024-11-09 06:47:20 +01:00
Fix trimming of leading and trailing spaces when adding a new file
This commit is contained in:
parent
f0033051d5
commit
f34a0b9f32
@ -392,6 +392,14 @@ func EditFilePost(ctx *context.Context) {
|
||||
// NewFilePost response for creating file
|
||||
func NewFilePost(ctx *context.Context) {
|
||||
form := web.GetForm(ctx).(*forms.EditRepoFileForm)
|
||||
|
||||
// trim leading and trailing spaces from the tree path
|
||||
treePath := strings.Split(form.TreePath, "/")
|
||||
for i, v := range treePath {
|
||||
treePath[i] = strings.TrimSpace(v)
|
||||
}
|
||||
form.TreePath = strings.Join(treePath, "/")
|
||||
|
||||
editFilePost(ctx, *form, true)
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user