]> source.dussan.org Git - gitea.git/commit
Avoid unnecessary 500 panic when a commit doesn't exist (#28719) (#28721)
authorGiteabot <teabot@gitea.io>
Sun, 7 Jan 2024 10:40:30 +0000 (18:40 +0800)
committerGitHub <noreply@github.com>
Sun, 7 Jan 2024 10:40:30 +0000 (10:40 +0000)
commit2399b4d483162e182fc09a3c7ffaf6359a0b4d90
treedfa16f0a9d9bff8280f43e8e3dea5471ceb5b1d4
parentad2cb9863c063c7d016baccda6fcd7aeb5518aad
Avoid unnecessary 500 panic when a commit doesn't exist (#28719) (#28721)

Backport #28719 by wxiaoguang

In #26851, it assumed that `Commit` always exists when
`PageIsDiff==true`.

But for a 404 page, the `Commit` doesn't exist, so the following code
would cause panic because nil value can't be passed as string parameter
to `IsMultilineCommitMessage(string)` (or the StringUtils.Cut in later
PRs)

Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
templates/base/head_opengraph.tmpl
tests/integration/repo_test.go