0
Fork 0
mirror of https://codeberg.org/forgejo/forgejo.git synced 2024-12-25 00:44:15 -05:00

Fix empty wiki (#5504)

* fix wiki page when wiki path is exist but empty

* improve the error check
This commit is contained in:
Lunny Xiao 2018-12-10 06:45:44 +08:00 committed by techknowlogick
parent 7e5abe2dc4
commit 928417ae39

View file

@ -74,7 +74,6 @@ func findWikiRepoCommit(ctx *context.Context) (*git.Repository, *git.Commit, err
commit, err := wikiRepo.GetBranchCommit("master") commit, err := wikiRepo.GetBranchCommit("master")
if err != nil { if err != nil {
ctx.ServerError("GetBranchCommit", err)
return wikiRepo, nil, err return wikiRepo, nil, err
} }
return wikiRepo, commit, nil 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) { func renderWikiPage(ctx *context.Context, isViewPage bool) (*git.Repository, *git.TreeEntry) {
wikiRepo, commit, err := findWikiRepoCommit(ctx) wikiRepo, commit, err := findWikiRepoCommit(ctx)
if err != nil { if err != nil {
if !git.IsErrNotExist(err) {
ctx.ServerError("GetBranchCommit", err)
}
return nil, nil return nil, nil
} }