mirror of
https://codeberg.org/Codeberg/pages-server.git
synced 2025-04-24 22:06:57 +00:00
code review fixes woohoo
This commit is contained in:
parent
6f7e694fd4
commit
924ad83ac6
2 changed files with 14 additions and 15 deletions
|
@ -187,12 +187,13 @@ func (client *Client) ServeRawContent(targetOwner, targetRepo, ref, resource str
|
|||
|
||||
// Check if size of gzipped response is greater than fileCacheSizeLimit and return gzipped
|
||||
// response but uncached or return non-gzip response if not supported
|
||||
len := int64(buf.Len());
|
||||
shouldRespBeSavedToCache := len < fileCacheSizeLimit
|
||||
shouldRespBeSavedToCache := int64(buf.Len()) < fileCacheSizeLimit
|
||||
if !shouldRespBeSavedToCache {
|
||||
return io.NopCloser(buf), resp.Response.Header, resp.StatusCode, err
|
||||
} else if !shouldRespBeSavedToCache && !acceptsGzip {
|
||||
return reader, resp.Response.Header, resp.StatusCode, err
|
||||
if acceptsGzip {
|
||||
return io.NopCloser(buf), resp.Response.Header, resp.StatusCode, err
|
||||
} else {
|
||||
return reader, resp.Response.Header, resp.StatusCode, err
|
||||
}
|
||||
}
|
||||
|
||||
// now we write to cache and respond at the same time
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue