|
|
@ -19,6 +19,7 @@ import (
|
|
|
|
"github.com/gogits/gogs/modules/context"
|
|
|
|
"github.com/gogits/gogs/modules/context"
|
|
|
|
"github.com/gogits/gogs/modules/log"
|
|
|
|
"github.com/gogits/gogs/modules/log"
|
|
|
|
"github.com/gogits/gogs/modules/markdown"
|
|
|
|
"github.com/gogits/gogs/modules/markdown"
|
|
|
|
|
|
|
|
"github.com/gogits/gogs/modules/setting"
|
|
|
|
"github.com/gogits/gogs/modules/template"
|
|
|
|
"github.com/gogits/gogs/modules/template"
|
|
|
|
"github.com/gogits/gogs/modules/template/highlight"
|
|
|
|
"github.com/gogits/gogs/modules/template/highlight"
|
|
|
|
)
|
|
|
|
)
|
|
|
@ -104,6 +105,10 @@ func Home(ctx *context.Context) {
|
|
|
|
case isImageFile:
|
|
|
|
case isImageFile:
|
|
|
|
ctx.Data["IsImageFile"] = true
|
|
|
|
ctx.Data["IsImageFile"] = true
|
|
|
|
case isTextFile:
|
|
|
|
case isTextFile:
|
|
|
|
|
|
|
|
if blob.Size() >= setting.MaxDisplayFileSize {
|
|
|
|
|
|
|
|
ctx.Data["IsFileTooLarge"] = true
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
ctx.Data["IsFileTooLarge"] = false
|
|
|
|
d, _ := ioutil.ReadAll(dataRc)
|
|
|
|
d, _ := ioutil.ReadAll(dataRc)
|
|
|
|
buf = append(buf, d...)
|
|
|
|
buf = append(buf, d...)
|
|
|
|
readmeExist := markdown.IsMarkdownFile(blob.Name()) || markdown.IsReadmeFile(blob.Name())
|
|
|
|
readmeExist := markdown.IsMarkdownFile(blob.Name()) || markdown.IsReadmeFile(blob.Name())
|
|
|
@ -122,6 +127,7 @@ func Home(ctx *context.Context) {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
// Directory and file list.
|
|
|
|
// Directory and file list.
|
|
|
|
tree, err := ctx.Repo.Commit.SubTree(treename)
|
|
|
|
tree, err := ctx.Repo.Commit.SubTree(treename)
|
|
|
|