修复缓存检查错误

This commit is contained in:
dragon
2025-01-10 17:18:10 +08:00
parent 9cada8facc
commit 7a936f35bc

View File

@@ -146,18 +146,19 @@ func (c *CacheBackendBlobReader) Open(owner, repo, commit, path string) (io.Read
// 无时间,跳过 // 无时间,跳过
return open.Body, nil return open.Body, nil
} }
// 没法计算大小,跳过
length, err := strconv.Atoi(open.Header.Get("Content-Length")) length, err := strconv.Atoi(open.Header.Get("Content-Length"))
// 无法计算大小,跳过
if err != nil { if err != nil {
return open.Body, err return open.Body, nil
} }
if length > c.maxSize { if length > c.maxSize {
// 超过最大大小,跳过 // 超过最大大小,跳过
return &utils.SizeReadCloser{ return &utils.SizeReadCloser{
ReadCloser: open.Body, ReadCloser: open.Body,
Size: length, Size: length,
}, err }, nil
} }
defer open.Body.Close() defer open.Body.Close()
allBytes, err := io.ReadAll(open.Body) allBytes, err := io.ReadAll(open.Body)
if err != nil { if err != nil {