Skip to content

Commit 5bd05de

Browse files
committed
Using an error message when the file name is invalid to replace trimming leading and trailing spaces.
1 parent ccb9705 commit 5bd05de

File tree

1 file changed

+1
-9
lines changed

1 file changed

+1
-9
lines changed

routers/web/repo/editor.go

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -317,7 +317,7 @@ func editFilePost(ctx *context.Context, form forms.EditRepoFileForm, isNewFile b
317317
case git.EntryModeBlob:
318318
ctx.RenderWithErr(ctx.Tr("repo.editor.directory_is_a_file", fileErr.Path), tplEditFile, &form)
319319
default:
320-
ctx.Error(http.StatusInternalServerError, err.Error())
320+
ctx.RenderWithErr(ctx.Tr("repo.editor.filename_is_invalid", fileErr.Path), tplEditFile, &form)
321321
}
322322
} else {
323323
ctx.Error(http.StatusInternalServerError, err.Error())
@@ -392,14 +392,6 @@ func EditFilePost(ctx *context.Context) {
392392
// NewFilePost response for creating file
393393
func NewFilePost(ctx *context.Context) {
394394
form := web.GetForm(ctx).(*forms.EditRepoFileForm)
395-
396-
// trim leading and trailing spaces from the tree path
397-
treePath := strings.Split(form.TreePath, "/")
398-
for i, v := range treePath {
399-
treePath[i] = strings.TrimSpace(v)
400-
}
401-
form.TreePath = strings.Join(treePath, "/")
402-
403395
editFilePost(ctx, *form, true)
404396
}
405397

0 commit comments

Comments
 (0)