From ed527b664dfa79ad62ef9b12d98ce5fe20f68303 Mon Sep 17 00:00:00 2001 From: Giteabot Date: Tue, 6 May 2025 13:18:12 +0800 Subject: [PATCH] Fix only text/* being viewable in web UI (#34374) (#34378) Backport #34374 by @bytedream Regression from #34356, files like SVGs should be editable too (https://github.com/go-gitea/gitea/pull/34356#discussion_r2072766240). Co-authored-by: bytedream --- routers/web/repo/editor.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/routers/web/repo/editor.go b/routers/web/repo/editor.go index 514eb0ebfe..03e5b830a0 100644 --- a/routers/web/repo/editor.go +++ b/routers/web/repo/editor.go @@ -165,7 +165,7 @@ func editFile(ctx *context.Context, isNewFile bool) { ctx.Data["FileSize"] = blob.Size() // Only some file types are editable online as text. - if !fInfo.isTextFile || fInfo.isLFSFile { + if !fInfo.st.IsRepresentableAsText() || fInfo.isLFSFile { ctx.NotFound(nil) return }