Browse Source

Fix empty wiki (#5504)

* fix wiki page when wiki path is exist but empty

* improve the error check
tags/v1.21.12.1
Lunny Xiao techknowlogick 7 years ago
parent
commit
928417ae39
1 changed files with 3 additions and 1 deletions
  1. +3
    -1
      routers/repo/wiki.go

+ 3
- 1
routers/repo/wiki.go View File

@@ -74,7 +74,6 @@ func findWikiRepoCommit(ctx *context.Context) (*git.Repository, *git.Commit, err

commit, err := wikiRepo.GetBranchCommit("master")
if err != nil {
ctx.ServerError("GetBranchCommit", err)
return wikiRepo, nil, err
}
return wikiRepo, commit, nil
@@ -112,6 +111,9 @@ func wikiContentsByName(ctx *context.Context, commit *git.Commit, wikiName strin
func renderWikiPage(ctx *context.Context, isViewPage bool) (*git.Repository, *git.TreeEntry) {
wikiRepo, commit, err := findWikiRepoCommit(ctx)
if err != nil {
if !git.IsErrNotExist(err) {
ctx.ServerError("GetBranchCommit", err)
}
return nil, nil
}



Loading…
Cancel
Save