mirror of
https://github.com/go-gitea/gitea.git
synced 2024-12-29 08:55:45 +00:00
fix readme view bug (#2566)
This commit is contained in:
parent
1eedd983ea
commit
1be2b4a262
@ -200,8 +200,10 @@ func renderFile(ctx *context.Context, entry *git.TreeEntry, treeLink, rawLink st
|
|||||||
ctx.Data["IsMarkup"] = isSupportedMarkup
|
ctx.Data["IsMarkup"] = isSupportedMarkup
|
||||||
readmeExist := markup.IsReadmeFile(blob.Name())
|
readmeExist := markup.IsReadmeFile(blob.Name())
|
||||||
ctx.Data["ReadmeExist"] = readmeExist
|
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()))
|
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 {
|
} else {
|
||||||
// Building code view blocks with line number on server side.
|
// Building code view blocks with line number on server side.
|
||||||
var fileContent string
|
var fileContent string
|
||||||
|
Loading…
Reference in New Issue
Block a user