From e84ac64964dc3011e6bc12dfbe6abfad3c0f0f3d Mon Sep 17 00:00:00 2001 From: Unknwon Date: Fri, 1 Jul 2016 15:34:03 +0800 Subject: Do not show filename not have suffifx .md --- routers/repo/wiki.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'routers/repo/wiki.go') diff --git a/routers/repo/wiki.go b/routers/repo/wiki.go index e0b3e692c1..a20bea25df 100644 --- a/routers/repo/wiki.go +++ b/routers/repo/wiki.go @@ -64,7 +64,7 @@ func renderWikiPage(ctx *context.Context, isViewPage bool) (*git.Repository, str } pages := make([]PageMeta, 0, len(entries)) for i := range entries { - if entries[i].Type == git.OBJECT_BLOB { + if entries[i].Type == git.OBJECT_BLOB && strings.HasSuffix(entries[i].Name(), ".md") { name := strings.TrimSuffix(entries[i].Name(), ".md") pages = append(pages, PageMeta{ Name: name, @@ -167,7 +167,7 @@ func WikiPages(ctx *context.Context) { } pages := make([]PageMeta, 0, len(entries)) for i := range entries { - if entries[i].Type == git.OBJECT_BLOB { + if entries[i].Type == git.OBJECT_BLOB && strings.HasSuffix(entries[i].Name(), ".md") { c, err := wikiRepo.GetCommitByPath(entries[i].Name()) if err != nil { ctx.Handle(500, "GetCommit", err) -- cgit v1.2.3