fix: correct checking the download size based on LimitedReader

This commit is contained in:
Derrick Hammer 2024-03-26 22:46:06 -04:00
parent 48da5d3fd4
commit d03a781e18
Signed by: pcfreak30
GPG Key ID: C997C339BE476FF2
1 changed files with 4 additions and 2 deletions

View File

@ -1238,9 +1238,11 @@ func (s *S5API) pinEntity(ctx context.Context, userId uint, userIp string, cid *
}
if !isCidManifest(cid) {
if limitedReader.N >= 0 && uint64(len(data)) != cid.Size {
if limitedReader.N > 0 {
if uint64(len(data)) != cid.Size {
return nil, false
}
}
} else {
dataCont, err := io.ReadAll(res.Body)
if err != nil {