Fix readme render bug (#15649)

This commit is contained in:
Lunny Xiao
2021-04-29 04:22:54 +08:00
repo.diff.committed_by GitHub
repo.diff.parent 2c57352a30
repo.diff.commit d7dbe4feeb

repo.diff.view_file

@@ -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", `<br>`,