From 2ed6a6f61b6ec7f99b791bdc84c083a8667fcb7e Mon Sep 17 00:00:00 2001 From: Abdellatif Anaflous <62770500+hktitof@users.noreply.github.com> Date: Mon, 2 Nov 2026 14:30:41 +0000 Subject: [PATCH] fix(web): read the wiki blob excerpt from the wiki repository (#40165) 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: Abdel Co-authored-by: silverwind --- routers/web/repo/compare.go | 2 +- tests/integration/wiki_test.go | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/routers/web/repo/compare.go b/routers/web/repo/compare.go index 1dcfa468406..604d861a6de 100644 --- a/routers/web/repo/compare.go +++ b/routers/web/repo/compare.go @@ -736,7 +736,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 diff --git a/tests/integration/wiki_test.go b/tests/integration/wiki_test.go index 9a1677b8924..b8269b898dc 100644 --- a/tests/integration/wiki_test.go +++ b/tests/integration/wiki_test.go @@ -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) {