mirror of
https://github.com/go-gitea/gitea.git
synced 2025-07-21 03:48:30 +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]
|
buf = buf[:n]
|
||||||
|
|
||||||
// Only some file types are editable online as text.
|
// 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 {
|
if blob.Size() >= setting.UI.MaxDisplayFileSize {
|
||||||
ctx.Data["IsFileTooLarge"] = true
|
ctx.Data["IsFileTooLarge"] = true
|
||||||
@ -179,6 +179,8 @@ func editFile(ctx *context.Context, isNewFile bool) {
|
|||||||
} else {
|
} else {
|
||||||
// Append filename from query, or empty string to allow username the new file.
|
// Append filename from query, or empty string to allow username the new file.
|
||||||
treeNames = append(treeNames, fileName)
|
treeNames = append(treeNames, fileName)
|
||||||
|
|
||||||
|
ctx.Data["IsFileEditable"] = true
|
||||||
}
|
}
|
||||||
|
|
||||||
ctx.Data["TreeNames"] = treeNames
|
ctx.Data["TreeNames"] = treeNames
|
||||||
|
@ -28,7 +28,7 @@
|
|||||||
<input type="hidden" id="tree_path" name="tree_path" value="{{.TreePath}}" required>
|
<input type="hidden" id="tree_path" name="tree_path" value="{{.TreePath}}" required>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
{{if .IsFileText}}
|
{{if .IsFileEditable}}
|
||||||
<div class="field">
|
<div class="field">
|
||||||
<div class="ui top attached header">
|
<div class="ui top attached header">
|
||||||
<div class="ui compact small menu small-menu-items repo-editor-menu">
|
<div class="ui compact small menu small-menu-items repo-editor-menu">
|
||||||
|
Loading…
x
Reference in New Issue
Block a user