diff --git a/routers/web/repo/editor.go b/routers/web/repo/editor.go index 91b9c069d9..af713bbafa 100644 --- a/routers/web/repo/editor.go +++ b/routers/web/repo/editor.go @@ -297,7 +297,7 @@ func editFilePost(ctx *context.Context, form forms.EditRepoFileForm, isNewFile b operation := "update" if isNewFile { operation = "create" - } else if !form.Content.Has() { + } else if !form.Content.Has() && ctx.Repo.TreePath != form.TreePath { // The form content only has data if file is representable as text, is not too large and not in lfs. If it doesn't // have data, the only possible operation is a rename operation = "rename"