Skip to content

Commit 79f4669

Browse files
committed
Fix bug
1 parent 5241e9a commit 79f4669

File tree

2 files changed

+7
-7
lines changed

2 files changed

+7
-7
lines changed

routers/api/v1/repo/wiki.go

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -177,17 +177,17 @@ func getWikiPage(ctx *context.APIContext, wikiName wiki_service.WebPath) *api.Wi
177177
}
178178

179179
// lookup filename in wiki - get filecontent, real filename
180-
content, pageFilename := wikiContentsByName(ctx, commit, wikiName, false)
180+
content, pageFilename := wikiContentsByName(ctx, wikiRepo, commit, wikiName, false)
181181
if ctx.Written() {
182182
return nil
183183
}
184184

185-
sidebarContent, _ := wikiContentsByName(ctx, commit, "_Sidebar", true)
185+
sidebarContent, _ := wikiContentsByName(ctx, wikiRepo, commit, "_Sidebar", true)
186186
if ctx.Written() {
187187
return nil
188188
}
189189

190-
footerContent, _ := wikiContentsByName(ctx, commit, "_Footer", true)
190+
footerContent, _ := wikiContentsByName(ctx, wikiRepo, commit, "_Footer", true)
191191
if ctx.Written() {
192192
return nil
193193
}
@@ -423,7 +423,7 @@ func ListPageRevisions(ctx *context.APIContext) {
423423
}
424424

425425
// lookup filename in wiki - get filecontent, gitTree entry , real filename
426-
_, pageFilename := wikiContentsByName(ctx, commit, pageName, false)
426+
_, pageFilename := wikiContentsByName(ctx, wikiRepo, commit, pageName, false)
427427
if ctx.Written() {
428428
return
429429
}
@@ -509,9 +509,9 @@ func wikiContentsByEntry(ctx *context.APIContext, entry *git.TreeEntry) string {
509509

510510
// wikiContentsByName returns the contents of a wiki page, along with a boolean
511511
// indicating whether the page exists. Writes to ctx if an error occurs.
512-
func wikiContentsByName(ctx *context.APIContext, commit *git.Commit, wikiName wiki_service.WebPath, isSidebarOrFooter bool) (string, string) {
512+
func wikiContentsByName(ctx *context.APIContext, wikiRepo *git.Repository, commit *git.Commit, wikiName wiki_service.WebPath, isSidebarOrFooter bool) (string, string) {
513513
gitFilename := wiki_service.WebPathToGitPath(wikiName)
514-
entry, err := findEntryForFile(git.NewTree(ctx.Repo.GitRepo, commit.TreeID), gitFilename)
514+
entry, err := findEntryForFile(git.NewTree(wikiRepo, commit.TreeID), gitFilename)
515515
if err != nil {
516516
if git.IsErrNotExist(err) {
517517
if !isSidebarOrFooter {

services/repository/files/content.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ func GetContentsOrList(ctx context.Context, repo *repo_model.Repository, gitRepo
6161
}
6262

6363
// list directory contents
64-
tree := git.NewTree(gitRepo, refCommit.Commit.ID)
64+
tree := git.NewTree(gitRepo, refCommit.Commit.TreeID)
6565
gitTree, err := tree.SubTree(opts.TreePath)
6666
if err != nil {
6767
return ret, err

0 commit comments

Comments
 (0)