forked from Gitlink/gitea-1156
fix: wiki repo is not closed
This commit is contained in:
parent
0c2be1c244
commit
88b3eafe77
|
@ -174,6 +174,11 @@ func CreateWiki(ctx *context.APIContext) {
|
|||
return
|
||||
}
|
||||
wikiRepo, commit, _ := webWiki.FindWikiRepoCommit(ctx.Context)
|
||||
defer func() {
|
||||
if wikiRepo != nil {
|
||||
wikiRepo.Close()
|
||||
}
|
||||
}()
|
||||
data, entry, pageFilename, _ := webWiki.WikiContentsByName(ctx.Context, commit, form.Name)
|
||||
metas := ctx.Repo.Repository.ComposeDocumentMetas()
|
||||
|
||||
|
@ -256,6 +261,11 @@ func GetWiki(ctx *context.APIContext) {
|
|||
// "$ref": "#/responses/Wiki"
|
||||
|
||||
wikiRepo, commit, _ := webWiki.FindWikiRepoCommit(ctx.Context)
|
||||
defer func() {
|
||||
if wikiRepo != nil {
|
||||
wikiRepo.Close()
|
||||
}
|
||||
}()
|
||||
|
||||
wikiCloneWiki := ctx.Repo.Repository.WikiCloneLink()
|
||||
|
||||
|
@ -366,6 +376,11 @@ func EditWiki(ctx *context.APIContext) {
|
|||
return
|
||||
}
|
||||
wikiRepo, commit, _ := webWiki.FindWikiRepoCommit(ctx.Context)
|
||||
defer func() {
|
||||
if wikiRepo != nil {
|
||||
wikiRepo.Close()
|
||||
}
|
||||
}()
|
||||
|
||||
if _, _, _, noEntry := webWiki.WikiContentsByName(ctx.Context, commit, oldWikiName); noEntry {
|
||||
ctx.Error(http.StatusNotFound, "WikiNotFound", "wiki不存在")
|
||||
|
@ -385,7 +400,12 @@ func EditWiki(ctx *context.APIContext) {
|
|||
ctx.Error(http.StatusInternalServerError, "EditWikiPage", err)
|
||||
return
|
||||
}
|
||||
_, newCommit, _ := webWiki.FindWikiRepoCommit(ctx.Context)
|
||||
wikiRepo, newCommit, _ := webWiki.FindWikiRepoCommit(ctx.Context)
|
||||
defer func() {
|
||||
if wikiRepo != nil {
|
||||
wikiRepo.Close()
|
||||
}
|
||||
}()
|
||||
data, entry, pageFilename, _ := webWiki.WikiContentsByName(ctx.Context, newCommit, newWikiName)
|
||||
c, err := wikiRepo.GetCommitByPath(entry.Name())
|
||||
if err != nil {
|
||||
|
|
Loading…
Reference in New Issue