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 <bytedream@protonmail.com>
This commit is contained in:
Giteabot 2025-05-06 13:18:12 +08:00 committed by GitHub
parent e4717d426e
commit ed527b664d
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -165,7 +165,7 @@ func editFile(ctx *context.Context, isNewFile bool) {
ctx.Data["FileSize"] = blob.Size() ctx.Data["FileSize"] = blob.Size()
// Only some file types are editable online as text. // Only some file types are editable online as text.
if !fInfo.isTextFile || fInfo.isLFSFile { if !fInfo.st.IsRepresentableAsText() || fInfo.isLFSFile {
ctx.NotFound(nil) ctx.NotFound(nil)
return return
} }