mirror of
https://codeberg.org/forgejo/forgejo.git
synced 2024-11-10 04:05:42 +01:00
[GITEA] Check for Commit in opengraph
- It's possible that `PageIsDiff` is set but not `Commit` resulting in a NPE in the template. This can happen when the requested commit doesn't exist. - Regression ofc802c46a9b
&5743d7cb5b
- Added 'hacky' integration test. (cherry picked from commit8db2d5e4a7
) (cherry picked from commit8c737a802b
)
This commit is contained in:
parent
4359741431
commit
6b7c7d18dc
1 changed files with 6 additions and 1 deletions
|
@ -683,7 +683,12 @@ func TestCommitView(t *testing.T) {
|
|||
defer tests.PrintCurrentTest(t)()
|
||||
|
||||
req := NewRequest(t, "GET", "/user2/repo1/commit/aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa")
|
||||
MakeRequest(t, req, http.StatusNotFound)
|
||||
req.SetHeader("Accept", "text/html")
|
||||
resp := MakeRequest(t, req, http.StatusNotFound)
|
||||
|
||||
// Really ensure that 404 is being sent back.
|
||||
doc := NewHTMLParser(t, resp.Body)
|
||||
doc.AssertElement(t, `[aria-label="Page Not Found"]`, true)
|
||||
})
|
||||
|
||||
t.Run("Too short commit ID", func(t *testing.T) {
|
||||
|
|
Loading…
Reference in a new issue