This commit is contained in:
parent
677f1872f6
commit
f433cede0a
|
@ -326,7 +326,12 @@ func ListWikiPages(ctx *context.APIContext) {
|
|||
continue
|
||||
}
|
||||
if entry.IsRegular() {
|
||||
c, err := wikiRepo.GetCommitByPath(fmt.Sprintf("%s/%s", filePath, entry.Name()))
|
||||
var commit *git.Commit
|
||||
if filePath == "" {
|
||||
commit, err = wikiRepo.GetCommitByPath(entry.Name())
|
||||
} else {
|
||||
commit, err = wikiRepo.GetCommitByPath(fmt.Sprintf("%s/%s", filePath, entry.Name()))
|
||||
}
|
||||
if err != nil {
|
||||
ctx.Error(http.StatusInternalServerError, "GetCommit", err)
|
||||
return
|
||||
|
@ -339,15 +344,20 @@ func ListWikiPages(ctx *context.APIContext) {
|
|||
ctx.Error(http.StatusInternalServerError, "WikiFilenameToName", err)
|
||||
return
|
||||
}
|
||||
lists = append(lists, convert.RegularToWikiPageMetaData(wikiName, c, ctx.Repo.Repository))
|
||||
lists = append(lists, convert.RegularToWikiPageMetaData(wikiName, commit, ctx.Repo.Repository))
|
||||
}
|
||||
if entry.IsDir() {
|
||||
c, err := wikiRepo.GetCommitByPath(fmt.Sprintf("%s/%s", filePath, entry.Name()))
|
||||
var commit *git.Commit
|
||||
if filePath == "" {
|
||||
commit, err = wikiRepo.GetCommitByPath(entry.Name())
|
||||
} else {
|
||||
commit, err = wikiRepo.GetCommitByPath(fmt.Sprintf("%s/%s", filePath, entry.Name()))
|
||||
}
|
||||
if err != nil {
|
||||
ctx.Error(http.StatusInternalServerError, "GetCommit", err)
|
||||
return
|
||||
}
|
||||
lists = append(lists, convert.DirToWikiPageMetaData(entry.Name(), c, ctx.Repo.Repository))
|
||||
lists = append(lists, convert.DirToWikiPageMetaData(entry.Name(), commit, ctx.Repo.Repository))
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue