From b8d5d358eee6c4090350c9d1646891a8ffeffaa4 Mon Sep 17 00:00:00 2001 From: bytedream Date: Fri, 9 May 2025 14:02:08 +0200 Subject: [PATCH] Update --- routers/web/repo/editor.go | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/routers/web/repo/editor.go b/routers/web/repo/editor.go index af713bbafa..b819a96819 100644 --- a/routers/web/repo/editor.go +++ b/routers/web/repo/editor.go @@ -177,11 +177,9 @@ func editFile(ctx *context.Context, isNewFile bool) { if fInfo.isLFSFile { ctx.Data["NotEditableReason"] = ctx.Tr("repo.editor.cannot_edit_lfs_files") - } else if !fInfo.isTextFile { + } else if !fInfo.st.IsRepresentableAsText() { ctx.Data["NotEditableReason"] = ctx.Tr("repo.editor.cannot_edit_non_text_files") - } - - if blob.Size() >= setting.UI.MaxDisplayFileSize { + } else if blob.Size() >= setting.UI.MaxDisplayFileSize { ctx.Data["NotEditableReason"] = ctx.Tr("repo.editor.cannot_edit_too_large_file") } else { d, _ := io.ReadAll(dataRc)