Skip to content

Commit cf44789

Browse files
committed
Fix new file not being editable
1 parent dcaadb8 commit cf44789

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

routers/web/repo/editor.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,7 @@ func editFile(ctx *context.Context, isNewFile bool) {
161161
buf = buf[:n]
162162

163163
// Only some file types are editable online as text.
164-
ctx.Data["IsFileText"] = typesniffer.DetectContentType(buf).IsRepresentableAsText()
164+
ctx.Data["IsFileEditable"] = typesniffer.DetectContentType(buf).IsRepresentableAsText()
165165

166166
if blob.Size() >= setting.UI.MaxDisplayFileSize {
167167
ctx.Data["IsFileTooLarge"] = true
@@ -179,6 +179,8 @@ func editFile(ctx *context.Context, isNewFile bool) {
179179
} else {
180180
// Append filename from query, or empty string to allow username the new file.
181181
treeNames = append(treeNames, fileName)
182+
183+
ctx.Data["IsFileEditable"] = true
182184
}
183185

184186
ctx.Data["TreeNames"] = treeNames

templates/repo/editor/edit.tmpl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
<input type="hidden" id="tree_path" name="tree_path" value="{{.TreePath}}" required>
2929
</div>
3030
</div>
31-
{{if .IsFileText}}
31+
{{if .IsFileEditable}}
3232
<div class="field">
3333
<div class="ui top attached header">
3434
<div class="ui compact small menu small-menu-items repo-editor-menu">

0 commit comments

Comments
 (0)