mirror of
https://github.com/go-gitea/gitea
synced 2025-12-07 13:28:25 +00:00
Backport #23152 `renderReadmeFile` needs `readmeTreelink` as parameter but gets `treeLink`. The values of them look like as following: `treeLink`: `/{OwnerName}/{RepoName}/src/branch/{BranchName}` `readmeTreelink`: `/{OwnerName}/{RepoName}/src/branch/{BranchName}/{ReadmeFileName}` `path.Dir` in https://github.com/go-gitea/gitea/blob/8540fc45b11eff9a73753ca139f8ea5c38509bf5/routers/web/repo/view.go#L316 should convert `readmeTreelink` into `/{OwnerName}/{RepoName}/src/branch/{BranchName}` instead of the current `/{OwnerName}/{RepoName}/src/branch`. Fixes #23151 Co-authored-by: yp05327 <576951401@qq.com> Co-authored-by: Jason Song <i@wolfogre.com> Co-authored-by: John Olheiser <john.olheiser@gmail.com> Co-authored-by: silverwind <me@silverwind.io>
This commit is contained in:
co-authored by
yp05327
Jason Song
John Olheiser
silverwind
parent
464bbd747e
commit
1322cd7a58
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
@@ -0,0 +1 @@
|
||||
78fb907e3a3309eae4fe8fef030874cebbf1cd5e
|
||||
@@ -256,3 +256,23 @@ func TestViewRepoDirectory(t *testing.T) {
|
||||
assert.Zero(t, repoTopics.Length())
|
||||
assert.Zero(t, repoSummary.Length())
|
||||
}
|
||||
|
||||
func TestMarkDownImage(t *testing.T) {
|
||||
defer tests.PrepareTestEnv(t)()
|
||||
|
||||
session := loginUser(t, "user2")
|
||||
|
||||
req := NewRequest(t, "GET", "/user2/repo1/src/branch/home-md-img-check")
|
||||
resp := session.MakeRequest(t, req, http.StatusOK)
|
||||
|
||||
htmlDoc := NewHTMLParser(t, resp.Body)
|
||||
_, exists := htmlDoc.doc.Find(`img[src="/user2/repo1/media/branch/home-md-img-check/test-fake-img.jpg"]`).Attr("src")
|
||||
assert.True(t, exists, "Repo home page markdown image link check failed")
|
||||
|
||||
req = NewRequest(t, "GET", "/user2/repo1/src/branch/home-md-img-check/README.md")
|
||||
resp = session.MakeRequest(t, req, http.StatusOK)
|
||||
|
||||
htmlDoc = NewHTMLParser(t, resp.Body)
|
||||
_, exists = htmlDoc.doc.Find(`img[src="/user2/repo1/media/branch/home-md-img-check/test-fake-img.jpg"]`).Attr("src")
|
||||
assert.True(t, exists, "Repo src page markdown image link check failed")
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user