{{if .IsRepo}}{{template "repo/header" .}}{{end}} -
- 404 -

{{if .NotFoundPrompt}}{{.NotFoundPrompt}}{{else}}{{ctx.Locale.Tr "error404"}}{{end}}

- {{if .NotFoundGoBackURL}}{{ctx.Locale.Tr "go_back"}}{{end}} +
+
+
404 Not Found
+
+
{{if .NotFoundPrompt}}{{.NotFoundPrompt}}{{else}}{{ctx.Locale.Tr "error404"}}{{end}}
+ {{if .NotFoundGoBackURL}} + {{ctx.Locale.Tr "go_back"}} + {{end}} +
+
{{template "base/footer" .}} diff --git a/templates/status/500.tmpl b/templates/status/500.tmpl index 566fddcec1..0e8d0f6593 100644 --- a/templates/status/500.tmpl +++ b/templates/status/500.tmpl @@ -33,17 +33,18 @@
{{template "base/alert" .}} -
-

Internal Server Error

-
-
- {{if .ErrorMsg}} -

{{ctx.Locale.Tr "error.occurred"}}:

-
{{.ErrorMsg}}
- {{end}} -
- {{if or .SignedUser.IsAdmin .ShowFooterVersion}}

{{ctx.Locale.Tr "admin.config.app_ver"}}: {{AppVer}}

{{end}} - {{if .SignedUser.IsAdmin}}

{{ctx.Locale.Tr "error.report_message"}}

{{end}} +
+
500 Internal Server Error
+ {{if .ErrorMsg}} +
+

{{ctx.Locale.Tr "error.occurred"}}:

+
{{.ErrorMsg}}
+
+ {{end}} +
+ {{if or .SignedUser.IsAdmin .ShowFooterVersion}}

{{ctx.Locale.Tr "admin.config.app_ver"}}: {{AppVer}}

{{end}} + {{if .SignedUser.IsAdmin}}

{{ctx.Locale.Tr "error.report_message"}}

{{end}} +
diff --git a/tests/integration/compare_test.go b/tests/integration/compare_test.go index 9f73ac80e2..d960416b3a 100644 --- a/tests/integration/compare_test.go +++ b/tests/integration/compare_test.go @@ -13,6 +13,7 @@ import ( "code.gitea.io/gitea/models/db" "code.gitea.io/gitea/models/unittest" user_model "code.gitea.io/gitea/models/user" + "code.gitea.io/gitea/modules/test" repo_service "code.gitea.io/gitea/services/repository" "code.gitea.io/gitea/tests" @@ -30,9 +31,9 @@ func TestCompareTag(t *testing.T) { // A dropdown for both base and head. assert.Lenf(t, selection.Nodes, 2, "The template has changed") - req = NewRequest(t, "GET", "/user2/repo1/compare/invalid") + req = NewRequest(t, "GET", "/user2/repo1/compare/invalid").SetHeader("Accept", "text/html") resp = session.MakeRequest(t, req, http.StatusNotFound) - assert.False(t, strings.Contains(resp.Body.String(), "/assets/img/500.png"), "expect 404 page not 500") + assert.True(t, test.IsNormalPageCompleted(resp.Body.String()), "expect 404 page not 500") } // Compare with inferred default branch (master) diff --git a/tests/integration/links_test.go b/tests/integration/links_test.go index d103e2b0a9..d3b30448fc 100644 --- a/tests/integration/links_test.go +++ b/tests/integration/links_test.go @@ -37,8 +37,6 @@ func TestLinksNoLogin(t *testing.T) { "/user2/repo1/projects", "/user2/repo1/projects/1", "/user2/repo1/releases/tag/delete-tag", // It's the only one existing record on release.yml which has is_tag: true - "/assets/img/404.png", - "/assets/img/500.png", "/.well-known/security.txt", } diff --git a/web_src/css/base.css b/web_src/css/base.css index eef4eb6eff..223d9fbad6 100644 --- a/web_src/css/base.css +++ b/web_src/css/base.css @@ -477,6 +477,20 @@ img.ui.avatar, padding-bottom: 80px; } +.status-page-error { + margin-top: max(45vh - 90px, 80px); + margin-bottom: 80px; +} + +.status-page-error-title { + font-size: 48px; + margin-bottom: 14px; /* some elements below may use tw-my-4 or tw-my-8, so use 14px as a minimal margin */ + line-height: initial; + text-align: center; + font-weight: var(--font-weight-bold); + color: var(--color-text-light-2); +} + /* add margin below .secondary nav when it is the first child */ .page-content > :first-child.secondary-nav { margin-bottom: 14px;