2
0

fix(pages): preload repository owner in landing page context
Some checks failed
Build and Release / Create Release (push) Successful in 0s
Build and Release / Integration Tests (PostgreSQL) (push) Successful in 2m52s
Build and Release / Unit Tests (push) Successful in 10m54s
Build and Release / Lint (push) Successful in 11m38s
Build and Release / Build Binaries (amd64, darwin, macos) (push) Failing after 1m36s
Build and Release / Build Binary (linux/arm64) (push) Failing after 1m33s
Build and Release / Build Binaries (amd64, windows, windows-latest) (push) Successful in 9h4m39s
Build and Release / Build Binaries (amd64, linux, linux-latest) (push) Successful in 6m23s
Build and Release / Build Binaries (arm64, darwin, macos) (push) Failing after 13m45s

Ensure repository owner is loaded before rendering landing pages to prevent template errors when accessing .Repository.Owner.Name. Add error logging if owner loading fails.
This commit is contained in:
2026-03-07 20:40:43 -05:00
parent cb2791709e
commit a2644bb47f

View File

@@ -137,6 +137,11 @@ func getRepoFromRequest(ctx *context.Context) (*repo_model.Repository, *pages_mo
// setupLandingPageContext sets up the shared template context data used by both
// the landing page and blog views (nav, footer, logo, repo info, etc.)
func setupLandingPageContext(ctx *context.Context, repo *repo_model.Repository, config *pages_module.LandingConfig) {
// Ensure Owner is loaded — templates access .Repository.Owner.Name
if err := repo.LoadOwner(ctx); err != nil {
log.Error("Failed to load repo owner for pages: %v", err)
}
ctx.Data["Repository"] = repo
ctx.Data["Config"] = config
if ctx.Data["Title"] == nil || ctx.Data["Title"] == "" {