diff options
author | Giteabot <teabot@gitea.io> | 2025-04-19 11:37:22 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2025-04-19 03:37:22 +0000 |
commit | 030ed9462dd04fcd1921889d1b67b4baf74a53cf (patch) | |
tree | eead76475f97d17d95a5a787cd715e15aa93df4a | |
parent | 60f175f7ff7aa5046413a57384334225f037bf41 (diff) | |
download | gitea-030ed9462dd04fcd1921889d1b67b4baf74a53cf.tar.gz gitea-030ed9462dd04fcd1921889d1b67b4baf74a53cf.zip |
Don't assume the default wiki branch is master in the wiki API (#34244) (#34245)
Backport #34244 by kemzeb
Resolves #34218.
In the recent past, the default wiki branch was made to be changeable.
This change reflects this.
Co-authored-by: Kemal Zebari <60799661+kemzeb@users.noreply.github.com>
-rw-r--r-- | routers/api/v1/repo/wiki.go | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/routers/api/v1/repo/wiki.go b/routers/api/v1/repo/wiki.go index f9906ed250..53dc948632 100644 --- a/routers/api/v1/repo/wiki.go +++ b/routers/api/v1/repo/wiki.go @@ -193,7 +193,7 @@ func getWikiPage(ctx *context.APIContext, wikiName wiki_service.WebPath) *api.Wi } // get commit count - wiki revisions - commitsCount, _ := wikiRepo.FileCommitsCount("master", pageFilename) + commitsCount, _ := wikiRepo.FileCommitsCount(ctx.Repo.Repository.DefaultWikiBranch, pageFilename) // Get last change information. lastCommit, err := wikiRepo.GetCommitByPath(pageFilename) @@ -432,7 +432,7 @@ func ListPageRevisions(ctx *context.APIContext) { } // get commit count - wiki revisions - commitsCount, _ := wikiRepo.FileCommitsCount("master", pageFilename) + commitsCount, _ := wikiRepo.FileCommitsCount(ctx.Repo.Repository.DefaultWikiBranch, pageFilename) page := ctx.FormInt("page") if page <= 1 { @@ -442,7 +442,7 @@ func ListPageRevisions(ctx *context.APIContext) { // get Commit Count commitsHistory, err := wikiRepo.CommitsByFileAndRange( git.CommitsByFileAndRangeOptions{ - Revision: "master", + Revision: ctx.Repo.Repository.DefaultWikiBranch, File: pageFilename, Page: page, }) @@ -486,7 +486,7 @@ func findWikiRepoCommit(ctx *context.APIContext) (*git.Repository, *git.Commit) return nil, nil } - commit, err := wikiRepo.GetBranchCommit("master") + commit, err := wikiRepo.GetBranchCommit(ctx.Repo.Repository.DefaultWikiBranch) if err != nil { if git.IsErrNotExist(err) { ctx.NotFound(err) |