修复缓存检查错误
This commit is contained in:
@@ -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 {
|
||||||
|
|||||||
Reference in New Issue
Block a user