aboutsummaryrefslogtreecommitdiffstats
path: root/routers/repo/wiki.go
diff options
context:
space:
mode:
Diffstat (limited to 'routers/repo/wiki.go')
-rw-r--r--routers/repo/wiki.go9
1 files changed, 5 insertions, 4 deletions
diff --git a/routers/repo/wiki.go b/routers/repo/wiki.go
index 790214e8e5..c0fb370dd9 100644
--- a/routers/repo/wiki.go
+++ b/routers/repo/wiki.go
@@ -57,7 +57,7 @@ func findEntryForFile(commit *git.Commit, target string) (*git.TreeEntry, error)
return nil, err
}
for _, entry := range entries {
- if entry.Type == git.ObjectBlob && entry.Name() == target {
+ if entry.IsRegular() && entry.Name() == target {
return entry, nil
}
}
@@ -81,11 +81,12 @@ func findWikiRepoCommit(ctx *context.Context) (*git.Repository, *git.Commit, err
// wikiContentsByEntry returns the contents of the wiki page referenced by the
// given tree entry. Writes to ctx if an error occurs.
func wikiContentsByEntry(ctx *context.Context, entry *git.TreeEntry) []byte {
- reader, err := entry.Blob().Data()
+ reader, err := entry.Blob().DataAsync()
if err != nil {
ctx.ServerError("Blob.Data", err)
return nil
}
+ defer reader.Close()
content, err := ioutil.ReadAll(reader)
if err != nil {
ctx.ServerError("ReadAll", err)
@@ -125,7 +126,7 @@ func renderWikiPage(ctx *context.Context, isViewPage bool) (*git.Repository, *gi
}
pages := make([]PageMeta, 0, len(entries))
for _, entry := range entries {
- if entry.Type != git.ObjectBlob {
+ if !entry.IsRegular() {
continue
}
wikiName, err := models.WikiFilenameToName(entry.Name())
@@ -259,7 +260,7 @@ func WikiPages(ctx *context.Context) {
}
pages := make([]PageMeta, 0, len(entries))
for _, entry := range entries {
- if entry.Type != git.ObjectBlob {
+ if !entry.IsRegular() {
continue
}
c, err := wikiRepo.GetCommitByPath(entry.Name())