fix panic when upstream fails

This commit is contained in:
crapStone 2024-12-26 20:14:49 +01:00
parent e079ce4cf4
commit c6e266128a
No known key found for this signature in database
GPG key ID: 22D4BF0CF7CC29C8
2 changed files with 6 additions and 3 deletions

View file

@ -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)