fix(web): read the wiki blob excerpt from the wiki repository (#40165) (#40178)

Backport #40165 by @hktitof

The "load more lines" button in wiki diffs returned 404. `ExcerptBlob`
loads the commit from the wiki repo but read the blob from
`ctx.Repo.GitRepo`, a regression from
https://github.com/go-gitea/gitea/pull/38464.

Read the blob from the repo the commit was loaded from.

Co-authored-by: Abdellatif Anaflous <62770500+hktitof@users.noreply.github.com>
Co-authored-by: Abdel <hktitof@users.noreply.github.com>
Co-authored-by: silverwind <me@silverwind.io>
This commit is contained in:
authored and GitHub committed 2026-11-02 10:35:23 -08:00
1 parent fb79898c28
commit 8fb1547a4c
2 files changed
+4 -1

No files matched your search

+1 -1
View File
@@ -734,7 +734,7 @@ func ExcerptBlob(ctx *context.Context) {
ctx.ServerError("GetCommit", err)
return
}
blob, err := commit.GetBlobByPath(ctx, ctx.Repo.GitRepo, filePath)
blob, err := commit.GetBlobByPath(ctx, gitRepo, filePath)
if err != nil {
ctx.ServerError("GetBlobByPath", err)
return
+3
View File
@@ -37,6 +37,9 @@ func TestRepoWikiPages(t *testing.T) {
assert.Equal(t, expectedPagePaths[i], pagePath)
})
req = NewRequest(t, "GET", "/user2/repo1/wiki/blob_excerpt/a5bbc0fd39a696feabed2d4cccaf05abbcaf3b02?last_left=0&last_right=0&left=2&right=2&left_hunk_size=2&right_hunk_size=2&path=Home.md&style=split&direction=up")
MakeRequest(t, req, http.StatusOK)
}
func testRepoWikiCloneHTTP(t *testing.T, u *url.URL) {