Fix only text/* being viewable in web UI (#34374) (#34378)
Some checks failed
release-nightly / nightly-binary (push) Has been cancelled
release-nightly / nightly-docker-rootful (push) Has been cancelled
release-nightly / nightly-docker-rootless (push) Has been cancelled

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

View File

@ -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
}