Browse Source

fix readme view bug (#2566)

for-closed-social
Lunny Xiao 7 years ago
committed by Lauris BH
parent
commit
1be2b4a262
1 changed files with 3 additions and 1 deletions
  1. +3
    -1
      routers/repo/view.go

+ 3
- 1
routers/repo/view.go View File

@ -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

Loading…
Cancel
Save