From 4908cc9adf88aaaa496f6bd658090f39ec196778 Mon Sep 17 00:00:00 2001 From: Giteabot Date: Tue, 20 Jun 2023 16:28:52 -0400 Subject: [PATCH] Fix blank dir message when uploading files from web editor (#25391) (#25400) Backport #25391 by @lunny Fix #7883 Co-authored-by: Lunny Xiao --- routers/web/repo/editor.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/routers/web/repo/editor.go b/routers/web/repo/editor.go index 7433a0a56..2fea8a953 100644 --- a/routers/web/repo/editor.go +++ b/routers/web/repo/editor.go @@ -685,7 +685,11 @@ func UploadFilePost(ctx *context.Context) { message := strings.TrimSpace(form.CommitSummary) if len(message) == 0 { - message = ctx.Tr("repo.editor.upload_files_to_dir", form.TreePath) + dir := form.TreePath + if dir == "" { + dir = "/" + } + message = ctx.Tr("repo.editor.upload_files_to_dir", dir) } form.CommitMessage = strings.TrimSpace(form.CommitMessage)