mirror of
https://codeberg.org/Codeberg/pages-server.git
synced 2025-04-19 03:26:57 +00:00
fix panic when upstream fails (#412)
Reviewed-on: https://codeberg.org/Codeberg/pages-server/pulls/412 Co-authored-by: crapStone <me@crapstone.dev> Co-committed-by: crapStone <me@crapstone.dev>
This commit is contained in:
parent
e079ce4cf4
commit
2438de0eb2
2 changed files with 6 additions and 3 deletions
|
@ -183,9 +183,12 @@ func (o *Options) Upstream(ctx *context.Context, giteaClient *gitea.Client, redi
|
|||
// add extension for encoding
|
||||
path := o.TargetPath + allowedEncodings[encoding]
|
||||
reader, header, statusCode, err = giteaClient.ServeRawContent(o.TargetOwner, o.TargetRepo, o.TargetBranch, path, true)
|
||||
if statusCode == 404 {
|
||||
if statusCode == http.StatusNotFound {
|
||||
continue
|
||||
}
|
||||
if err != nil {
|
||||
break
|
||||
}
|
||||
log.Debug().Msgf("using %s encoding", encoding)
|
||||
if encoding != "identity" {
|
||||
header.Set(headerContentEncoding, encoding)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue