From 8fb3a50a3791147f992089f8b9f986e9b94542d8 Mon Sep 17 00:00:00 2001
From: KN4CK3R <admin@oldschoolhack.me>
Date: Sat, 18 Sep 2021 04:46:57 +0200
Subject: [PATCH] Render full plain readme. (#17083)

---
 routers/web/repo/view.go | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/routers/web/repo/view.go b/routers/web/repo/view.go
index 2c703fc1af..c71562f271 100644
--- a/routers/web/repo/view.go
+++ b/routers/web/repo/view.go
@@ -353,6 +353,10 @@ func renderDirectory(ctx *context.Context, treeLink string) {
 					}
 				} else {
 					ctx.Data["IsRenderedHTML"] = true
+					buf, err = ioutil.ReadAll(rd)
+					if err != nil {
+						log.Error("ReadAll failed: %v", err)
+					}
 					ctx.Data["FileContent"] = strings.ReplaceAll(
 						gotemplate.HTMLEscapeString(string(buf)), "\n", `<br>`,
 					)