summaryrefslogtreecommitdiffstats
path: root/routers
diff options
context:
space:
mode:
authorLunny Xiao <xiaolunwen@gmail.com>2023-06-20 21:58:03 +0200
committerGitHub <noreply@github.com>2023-06-20 21:58:03 +0200
commit54259dbf37f4a7f7d8865755484cbcad1c9ea8c0 (patch)
tree792b4c8a50e2d55bfd3593233aef2387854c191d /routers
parentAdd git-lfs support to devcontainer (#25385) (diff)
downloadforgejo-54259dbf37f4a7f7d8865755484cbcad1c9ea8c0.tar.xz
forgejo-54259dbf37f4a7f7d8865755484cbcad1c9ea8c0.zip
Fix blank dir message when uploading files from web editor (#25391)
Fix #7883
Diffstat (limited to 'routers')
-rw-r--r--routers/web/repo/editor.go6
1 files changed, 5 insertions, 1 deletions
diff --git a/routers/web/repo/editor.go b/routers/web/repo/editor.go
index 7433a0a56b..2fea8a9532 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)