[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 commit 8db2d5e4a76f05b34e4f889e7a00ecd6578d3639) (cherry picked from commit 8c737a802bcae54195f1bb15bb0b8aca824ef395) (cherry picked from commit 6b7c7d18dcdcfa135ff2657fbac8ce157eaf0dfa) (cherry picked from commit a2be4fab27b98b2932486f2b03635b044742f964) (cherry picked from commit a1125268aca2796d08e02b7a36bfb36172917b38)
This commit is contained in:
parent
f90b802634
commit
159dc74ceb
|
@ -683,7 +683,12 @@ func TestCommitView(t *testing.T) {
|
||||||
defer tests.PrintCurrentTest(t)()
|
defer tests.PrintCurrentTest(t)()
|
||||||
|
|
||||||
req := NewRequest(t, "GET", "/user2/repo1/commit/aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa")
|
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) {
|
t.Run("Too short commit ID", func(t *testing.T) {
|
||||||
|
|
Loading…
Reference in a new issue