mirror of
https://github.com/go-gitea/gitea.git
synced 2025-07-20 23:28:28 +02:00
Fix new file not being editable
This commit is contained in:
parent
dcaadb801f
commit
cf44789a00
@ -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
|
||||
|
@ -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">
|
||||
|
Loading…
x
Reference in New Issue
Block a user