Browse Source

fix ext

pull/32/head
slene 11 years ago
parent
commit
47234f1031
  1. 2
      modules/base/markdown.go
  2. 6
      routers/repo/single.go

2
modules/base/markdown.go

@ -36,7 +36,7 @@ func isLink(link []byte) bool {
func IsMarkdownFile(name string) bool { func IsMarkdownFile(name string) bool {
name = strings.ToLower(name) name = strings.ToLower(name)
switch filepath.Ext(name) { switch filepath.Ext(name) {
case "md", "markdown", "mdown": case ".md", ".markdown", ".mdown":
return true return true
} }
return false return false

6
routers/repo/single.go

@ -96,7 +96,11 @@ func Single(ctx *middleware.Context, params martini.Params) {
} else { } else {
ctx.Data["IsFile"] = true ctx.Data["IsFile"] = true
ctx.Data["FileName"] = repoFile.Name ctx.Data["FileName"] = repoFile.Name
ctx.Data["FileExt"] = path.Ext(repoFile.Name) ext := path.Ext(repoFile.Name)
if len(ext) > 0 {
ext = ext[1:]
}
ctx.Data["FileExt"] = ext
readmeExist := base.IsMarkdownFile(repoFile.Name) || base.IsReadmeFile(repoFile.Name) readmeExist := base.IsMarkdownFile(repoFile.Name) || base.IsReadmeFile(repoFile.Name)
ctx.Data["ReadmeExist"] = readmeExist ctx.Data["ReadmeExist"] = readmeExist

Loading…
Cancel
Save