mirror of
https://codeberg.org/forgejo/forgejo.git
synced 2024-11-14 02:24:03 +00:00
work on #1904
This commit is contained in:
parent
3ec650b0ef
commit
0d4498429c
|
@ -5,7 +5,7 @@ Gogs - Go Git Service [![Build Status](https://travis-ci.org/gogits/gogs.svg?bra
|
||||||
|
|
||||||
![](public/img/gogs-large-resize.png)
|
![](public/img/gogs-large-resize.png)
|
||||||
|
|
||||||
##### Current version: 0.7.1 Beta
|
##### Current version: 0.7.2 Beta
|
||||||
|
|
||||||
<table>
|
<table>
|
||||||
<tr>
|
<tr>
|
||||||
|
|
2
gogs.go
2
gogs.go
|
@ -17,7 +17,7 @@ import (
|
||||||
"github.com/gogits/gogs/modules/setting"
|
"github.com/gogits/gogs/modules/setting"
|
||||||
)
|
)
|
||||||
|
|
||||||
const APP_VER = "0.7.1.1108 Beta"
|
const APP_VER = "0.7.2.1109 Beta"
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
runtime.GOMAXPROCS(runtime.NumCPU())
|
runtime.GOMAXPROCS(runtime.NumCPU())
|
||||||
|
|
|
@ -31,14 +31,19 @@ func Home(ctx *middleware.Context) {
|
||||||
|
|
||||||
repoLink := ctx.Repo.RepoLink
|
repoLink := ctx.Repo.RepoLink
|
||||||
branchLink := ctx.Repo.RepoLink + "/src/" + branchName
|
branchLink := ctx.Repo.RepoLink + "/src/" + branchName
|
||||||
|
treeLink := branchLink
|
||||||
rawLink := ctx.Repo.RepoLink + "/raw/" + branchName
|
rawLink := ctx.Repo.RepoLink + "/raw/" + branchName
|
||||||
|
|
||||||
// Get tree path
|
// Get tree path
|
||||||
treename := ctx.Repo.TreeName
|
treename := ctx.Repo.TreeName
|
||||||
|
|
||||||
if len(treename) > 0 && treename[len(treename)-1] == '/' {
|
if len(treename) > 0 {
|
||||||
ctx.Redirect(repoLink + "/src/" + branchName + "/" + treename[:len(treename)-1])
|
if treename[len(treename)-1] == '/' {
|
||||||
return
|
ctx.Redirect(repoLink + "/src/" + branchName + "/" + treename[:len(treename)-1])
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
treeLink += "/" + treename
|
||||||
}
|
}
|
||||||
|
|
||||||
ctx.Data["IsRepoToolbarSource"] = true
|
ctx.Data["IsRepoToolbarSource"] = true
|
||||||
|
@ -98,7 +103,7 @@ func Home(ctx *middleware.Context) {
|
||||||
readmeExist := base.IsMarkdownFile(blob.Name()) || base.IsReadmeFile(blob.Name())
|
readmeExist := base.IsMarkdownFile(blob.Name()) || base.IsReadmeFile(blob.Name())
|
||||||
ctx.Data["ReadmeExist"] = readmeExist
|
ctx.Data["ReadmeExist"] = readmeExist
|
||||||
if readmeExist {
|
if readmeExist {
|
||||||
ctx.Data["FileContent"] = string(base.RenderMarkdown(buf, branchLink))
|
ctx.Data["FileContent"] = string(base.RenderMarkdown(buf, path.Dir(treeLink)))
|
||||||
} else {
|
} else {
|
||||||
if err, content := base.ToUtf8WithErr(buf); err != nil {
|
if err, content := base.ToUtf8WithErr(buf); err != nil {
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -191,7 +196,7 @@ func Home(ctx *middleware.Context) {
|
||||||
buf = append(buf, d...)
|
buf = append(buf, d...)
|
||||||
switch {
|
switch {
|
||||||
case base.IsMarkdownFile(readmeFile.Name()):
|
case base.IsMarkdownFile(readmeFile.Name()):
|
||||||
buf = base.RenderMarkdown(buf, branchLink)
|
buf = base.RenderMarkdown(buf, treeLink)
|
||||||
default:
|
default:
|
||||||
buf = bytes.Replace(buf, []byte("\n"), []byte(`<br>`), -1)
|
buf = bytes.Replace(buf, []byte("\n"), []byte(`<br>`), -1)
|
||||||
}
|
}
|
||||||
|
|
|
@ -1 +1 @@
|
||||||
0.7.1.1108 Beta
|
0.7.2.1109 Beta
|
Loading…
Reference in a new issue