mirror of
https://codeberg.org/Codeberg/pages-server.git
synced 2025-07-04 09:16:35 +00:00
fix: nil pointer access (#504)
Reviewed-on: https://codeberg.org/Codeberg/pages-server/pulls/504 Co-authored-by: crapStone <me@crapstone.dev> Co-committed-by: crapStone <me@crapstone.dev>
This commit is contained in:
parent
16ae6eacfe
commit
838a5bda92
4 changed files with 56 additions and 21 deletions
|
@ -64,8 +64,12 @@ func handleRaw(log zerolog.Logger, ctx *context.Context, giteaClient *gitea.Clie
|
|||
log.Trace().Msg("tryUpstream: serve raw domain with default branch")
|
||||
tryUpstream(log, ctx, giteaClient, mainDomainSuffix, trimmedHost, targetOpt, canonicalDomainCache, redirectsCache)
|
||||
} else {
|
||||
html.ReturnErrorPage(ctx,
|
||||
fmt.Sprintf("raw domain could not find repo <code>%s/%s</code> or repo is empty", targetOpt.TargetOwner, targetOpt.TargetRepo),
|
||||
http.StatusNotFound)
|
||||
if targetOpt == nil {
|
||||
html.ReturnErrorPage(ctx, "raw domain could not find repo", http.StatusNotFound)
|
||||
} else {
|
||||
html.ReturnErrorPage(ctx,
|
||||
fmt.Sprintf("raw domain could not find repo <code>%s/%s</code> or repo is empty", targetOpt.TargetOwner, targetOpt.TargetRepo),
|
||||
http.StatusNotFound)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue