Merge pull request 'fix(ui): /settings/lfs/find 500 error' (#3448) from earl-warren/forgejo:wip-lfs-template into forgejo

Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/3448
Reviewed-by: Otto <otto@codeberg.org>
This commit is contained in:
Earl Warren 2024-04-25 15:12:39 +00:00
commit a8413a1539
3 changed files with 26 additions and 4 deletions

View file

@ -26,8 +26,8 @@ In addition to the following notable bug fixes, you can browse the [full list of
* **Bug fixes:**
* The regression in the [`fogejo admin user create`](https://forgejo.org/docs/v7.0/admin/command-line/#admin-user-create) CLI command [is fixed](https://codeberg.org/forgejo/forgejo/issues/3399) and it is backward compatible.
- Fixed a bug where the `/api/v1/repos/{owner}/{repo}/wiki` API endpoints were using a hardcoded "master" branch for the wiki, rather than the branch they really use. ([#3430](https://codeberg.org/forgejo/forgejo/pulls/3430))
* Fixed a bug where the `/api/v1/repos/{owner}/{repo}/wiki` API endpoints were using a hardcoded "master" branch for the wiki, rather than the branch they really use. ([#3430](https://codeberg.org/forgejo/forgejo/pulls/3430))
* Fixed an error 500 when visiting [the LFS settings]() at `/{owner}/{repo}/settings/lfs/find?oid=...`.
## 7.0.0

View file

@ -23,9 +23,9 @@
<span class="text grey">{{svg "octicon-git-branch"}}{{.BranchName}}</span>
</td>
<td>
{{if .ParentHashes}}
{{if .ParentIDs}}
{{ctx.Locale.Tr "repo.diff.parent"}}
{{range .ParentHashes}}
{{range .ParentIDs}}
<a class="ui primary sha label" href="{{$.RepoLink}}/commit/{{.String}}">{{ShortSha .String}}</a>
{{end}}
{{end}}

View file

@ -80,4 +80,26 @@ func TestLFSRender(t *testing.T) {
content := doc.Find("div.file-view").Text()
assert.Contains(t, content, "Testing READMEs in LFS")
})
t.Run("/settings/lfs/pointers", func(t *testing.T) {
defer tests.PrintCurrentTest(t)()
// visit /user2/lfs/settings/lfs/pointer
req := NewRequest(t, "GET", "/user2/lfs/settings/lfs/pointers")
resp := session.MakeRequest(t, req, http.StatusOK)
// follow the first link to /user2/lfs/settings/lfs/find?oid=....
filesTable := NewHTMLParser(t, resp.Body).doc.Find("#lfs-files-table")
assert.Contains(t, filesTable.Text(), "Find commits")
lfsFind := filesTable.Find(`.primary.button[href^="/user2"]`)
assert.Greater(t, lfsFind.Length(), 0)
lfsFindPath, exists := lfsFind.First().Attr("href")
assert.True(t, exists)
assert.Contains(t, lfsFindPath, "oid=")
req = NewRequest(t, "GET", lfsFindPath)
resp = session.MakeRequest(t, req, http.StatusOK)
doc := NewHTMLParser(t, resp.Body).doc
assert.Contains(t, doc.Text(), "README.md")
})
}