mirror of
https://codeberg.org/forgejo/forgejo.git
synced 2024-11-10 20:01:24 +01:00
Merge pull request '[GITEA] Check for Commit in opengraph' (#2094) from gusted/forgejo-graceful-commit into forgejo-dependency
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/2094 Reviewed-by: Earl Warren <earl-warren@noreply.codeberg.org>
This commit is contained in:
commit
5f7875e416
2 changed files with 7 additions and 2 deletions
|
@ -17,7 +17,7 @@
|
|||
{{else if or .PageIsDiff .IsViewFile}}
|
||||
<meta property="og:title" content="{{.Title}}">
|
||||
<meta property="og:url" content="{{AppUrl}}{{.Link}}">
|
||||
{{if .PageIsDiff}}
|
||||
{{if and .PageIsDiff .Commit}}
|
||||
{{- $commitMessageParts := StringUtils.Cut .Commit.Message "\n" -}}
|
||||
{{- $commitMessageBody := index $commitMessageParts 1 -}}
|
||||
{{- if $commitMessageBody -}}
|
||||
|
|
|
@ -673,7 +673,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