mirror of
https://codeberg.org/Codeberg/pages-server.git
synced 2024-11-05 14:07:01 +00:00
minimize diff
This commit is contained in:
parent
218b52094e
commit
f96d11896f
1 changed files with 8 additions and 5 deletions
|
@ -83,13 +83,15 @@ func (o *Options) Upstream(ctx *context.Context, giteaClient *gitea.Client) (fin
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
log.Debug().Msg("preparations")
|
|
||||||
|
log.Debug().Msg("Preparing")
|
||||||
|
|
||||||
reader, res, err := giteaClient.ServeRawContent(o.TargetOwner, o.TargetRepo, o.TargetBranch, o.TargetPath)
|
reader, res, err := giteaClient.ServeRawContent(o.TargetOwner, o.TargetRepo, o.TargetBranch, o.TargetPath)
|
||||||
if reader != nil {
|
if reader != nil {
|
||||||
defer reader.Close()
|
defer reader.Close()
|
||||||
}
|
}
|
||||||
log.Debug().Msg("acquisition")
|
|
||||||
|
log.Debug().Msg("Aquisting")
|
||||||
|
|
||||||
// Handle errors
|
// Handle errors
|
||||||
if (err != nil && errors.Is(err, gitea.ErrorNotFound)) || (res == nil) {
|
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)
|
ctx.Redirect(o.redirectIfExists, http.StatusTemporaryRedirect)
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
log.Debug().Msg("error handling")
|
|
||||||
|
log.Debug().Msg("Handling error")
|
||||||
|
|
||||||
// Set ETag & MIME
|
// Set ETag & MIME
|
||||||
if res != nil {
|
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))
|
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
|
// Write the response body to the original request
|
||||||
if reader != nil {
|
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
|
return true
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue