0
0
mirror of https://github.com/go-gitea/gitea.git synced 2025-07-20 06:08:29 +02:00

Fix new file not being editable

This commit is contained in:
bytedream 2025-05-03 03:20:22 +02:00
parent dcaadb801f
commit cf44789a00
2 changed files with 4 additions and 2 deletions

View File

@ -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

View File

@ -28,7 +28,7 @@
<input type="hidden" id="tree_path" name="tree_path" value="{{.TreePath}}" required>
</div>
</div>
{{if .IsFileText}}
{{if .IsFileEditable}}
<div class="field">
<div class="ui top attached header">
<div class="ui compact small menu small-menu-items repo-editor-menu">