diff options
Diffstat (limited to 'routers/repo/view.go')
-rw-r--r-- | routers/repo/view.go | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/routers/repo/view.go b/routers/repo/view.go index ff5c1afb49..210eb9fe5f 100644 --- a/routers/repo/view.go +++ b/routers/repo/view.go @@ -25,6 +25,7 @@ import ( "code.gitea.io/gitea/modules/markup" "code.gitea.io/gitea/modules/setting" "code.gitea.io/gitea/modules/templates" + "github.com/Unknwon/paginater" ) @@ -99,7 +100,8 @@ func renderDirectory(ctx *context.Context, treeLink string) { ctx.Data["FileSize"] = readmeFile.Size() } else { d, _ := ioutil.ReadAll(dataRc) - buf = append(buf, d...) + buf = templates.ToUTF8WithFallback(append(buf, d...)) + if markup.Type(readmeFile.Name()) != "" { ctx.Data["IsMarkup"] = true ctx.Data["FileContent"] = string(markup.Render(readmeFile.Name(), buf, treeLink, ctx.Repo.Repository.ComposeMetas())) @@ -203,7 +205,7 @@ func renderFile(ctx *context.Context, entry *git.TreeEntry, treeLink, rawLink st } d, _ := ioutil.ReadAll(dataRc) - buf = append(buf, d...) + buf = templates.ToUTF8WithFallback(append(buf, d...)) readmeExist := markup.IsReadmeFile(blob.Name()) ctx.Data["ReadmeExist"] = readmeExist |