summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLunny Xiao <xiaolunwen@gmail.com>2017-09-22 02:24:19 +0800
committerLauris BH <lauris@nix.lv>2017-09-21 21:24:19 +0300
commit1be2b4a262ebb4713111f496b9dd4c106089fafe (patch)
tree065b6a0f07872bc12007516fb7deb2bfe0244a7b
parent1eedd983ea0f387b6e72264b1cd195a4d3ea1253 (diff)
downloadgitea-1be2b4a262ebb4713111f496b9dd4c106089fafe.tar.gz
gitea-1be2b4a262ebb4713111f496b9dd4c106089fafe.zip
fix readme view bug (#2566)
-rw-r--r--routers/repo/view.go4
1 files changed, 3 insertions, 1 deletions
diff --git a/routers/repo/view.go b/routers/repo/view.go
index bfba7acac8..64a2e2ea76 100644
--- a/routers/repo/view.go
+++ b/routers/repo/view.go
@@ -200,8 +200,10 @@ func renderFile(ctx *context.Context, entry *git.TreeEntry, treeLink, rawLink st
ctx.Data["IsMarkup"] = isSupportedMarkup
readmeExist := markup.IsReadmeFile(blob.Name())
ctx.Data["ReadmeExist"] = readmeExist
- if readmeExist && isSupportedMarkup {
+ if isSupportedMarkup {
ctx.Data["FileContent"] = string(markup.Render(blob.Name(), buf, path.Dir(treeLink), ctx.Repo.Repository.ComposeMetas()))
+ } else if readmeExist {
+ ctx.Data["FileContent"] = string(bytes.Replace(buf, []byte("\n"), []byte(`<br>`), -1))
} else {
// Building code view blocks with line number on server side.
var fileContent string