From d7dbe4feebac7805a4ca184f0989f58de8063d96 Mon Sep 17 00:00:00 2001 From: Lunny Xiao Date: Thu, 29 Apr 2021 04:22:54 +0800 Subject: [PATCH] Fix readme render bug (#15649) --- routers/repo/view.go | 1 + 1 file changed, 1 insertion(+) diff --git a/routers/repo/view.go b/routers/repo/view.go index 10deb7065..285cacc2d 100644 --- a/routers/repo/view.go +++ b/routers/repo/view.go @@ -512,6 +512,7 @@ func renderFile(ctx *context.Context, entry *git.TreeEntry, treeLink, rawLink st } ctx.Data["FileContent"] = result.String() } else if readmeExist { + buf, _ := ioutil.ReadAll(rd) ctx.Data["IsRenderedHTML"] = true ctx.Data["FileContent"] = strings.ReplaceAll( gotemplate.HTMLEscapeString(string(buf)), "\n", `
`,