mirror of
https://codeberg.org/Codeberg/pages-server.git
synced 2024-11-05 14:07:01 +00:00
code format
This commit is contained in:
parent
cba996978e
commit
ae610d301a
1 changed files with 5 additions and 5 deletions
|
@ -60,7 +60,7 @@ func (f FileResponse) createHttpResponse(cacheKey string) (http.Header, int) {
|
|||
header.Set(ContentLengthHeader, fmt.Sprintf("%d", len(f.Body)))
|
||||
header.Set(PagesCacheIndicatorHeader, "true")
|
||||
|
||||
log.Trace().Msgf("fileCache for '%s' used", cacheKey)
|
||||
log.Trace().Msgf("fileCache for %q used", cacheKey)
|
||||
return header, statusCode
|
||||
}
|
||||
|
||||
|
@ -95,19 +95,19 @@ func (t *writeCacheReader) Close() error {
|
|||
fc.Body = t.buff.Bytes()
|
||||
_ = t.cache.Set(t.cacheKey, fc, fileCacheTimeout)
|
||||
}
|
||||
log.Trace().Msgf("cacheReader for '%s' saved=%v closed", t.cacheKey, !t.hasErr)
|
||||
log.Trace().Msgf("cacheReader for %q saved=%t closed", t.cacheKey, !t.hasErr)
|
||||
return t.rc.Close()
|
||||
}
|
||||
|
||||
func (f FileResponse) CreateCacheReader(r io.ReadCloser, cache cache.SetGetKey, cacheKey string) io.ReadCloser {
|
||||
buf := []byte{}
|
||||
if r == nil || cache == nil || cacheKey == "" {
|
||||
log.Error().Msg("could not create CacheReader")
|
||||
return r
|
||||
return nil
|
||||
}
|
||||
|
||||
return &writeCacheReader{
|
||||
rc: r,
|
||||
buff: bytes.NewBuffer(buf),
|
||||
buff: bytes.NewBuffer(make([]byte, 0)),
|
||||
f: &f,
|
||||
cache: cache,
|
||||
cacheKey: cacheKey,
|
||||
|
|
Loading…
Reference in a new issue