minimize diff

This commit is contained in:
6543 2022-11-07 23:06:40 +01:00
parent 218b52094e
commit f96d11896f
No known key found for this signature in database
GPG key ID: B8BE6D610E61C862

View file

@ -83,13 +83,15 @@ func (o *Options) Upstream(ctx *context.Context, giteaClient *gitea.Client) (fin
return true
}
}
log.Debug().Msg("preparations")
log.Debug().Msg("Preparing")
reader, res, err := giteaClient.ServeRawContent(o.TargetOwner, o.TargetRepo, o.TargetBranch, o.TargetPath)
if reader != nil {
defer reader.Close()
}
log.Debug().Msg("acquisition")
log.Debug().Msg("Aquisting")
// Handle errors
if (err != nil && errors.Is(err, gitea.ErrorNotFound)) || (res == nil) {
@ -148,7 +150,8 @@ func (o *Options) Upstream(ctx *context.Context, giteaClient *gitea.Client) (fin
ctx.Redirect(o.redirectIfExists, http.StatusTemporaryRedirect)
return true
}
log.Debug().Msg("error handling")
log.Debug().Msg("Handling error")
// Set ETag & MIME
if res != nil {
@ -166,7 +169,7 @@ func (o *Options) Upstream(ctx *context.Context, giteaClient *gitea.Client) (fin
}
ctx.Response().Header.Set(headerLastModified, o.BranchTimestamp.In(time.UTC).Format(time.RFC1123))
log.Debug().Msg("response preparations")
log.Debug().Msg("Prepare response")
// Write the response body to the original request
if reader != nil {
@ -178,7 +181,7 @@ func (o *Options) Upstream(ctx *context.Context, giteaClient *gitea.Client) (fin
}
}
log.Debug().Msg("response")
log.Debug().Msg("Sending response")
return true
}