diff --git a/routers/web/repo/editor.go b/routers/web/repo/editor.go index 542ba93e74..5df7a1bbcc 100644 --- a/routers/web/repo/editor.go +++ b/routers/web/repo/editor.go @@ -161,7 +161,7 @@ func editFile(ctx *context.Context, isNewFile bool) { buf = buf[:n] // Only some file types are editable online as text. - ctx.Data["IsFileText"] = typesniffer.DetectContentType(buf).IsRepresentableAsText() + ctx.Data["IsFileEditable"] = typesniffer.DetectContentType(buf).IsRepresentableAsText() if blob.Size() >= setting.UI.MaxDisplayFileSize { ctx.Data["IsFileTooLarge"] = true @@ -179,6 +179,8 @@ func editFile(ctx *context.Context, isNewFile bool) { } else { // Append filename from query, or empty string to allow username the new file. treeNames = append(treeNames, fileName) + + ctx.Data["IsFileEditable"] = true } ctx.Data["TreeNames"] = treeNames diff --git a/templates/repo/editor/edit.tmpl b/templates/repo/editor/edit.tmpl index 9a59fdac70..0c452661e3 100644 --- a/templates/repo/editor/edit.tmpl +++ b/templates/repo/editor/edit.tmpl @@ -28,7 +28,7 @@ - {{if .IsFileText}} + {{if .IsFileEditable}}