From d03a781e1865d2087ca3b6db2a67fb21ea35ae0c Mon Sep 17 00:00:00 2001 From: Derrick Hammer Date: Tue, 26 Mar 2024 22:46:06 -0400 Subject: [PATCH] fix: correct checking the download size based on LimitedReader --- api/s5/s5.go | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/api/s5/s5.go b/api/s5/s5.go index 259df14..0552402 100644 --- a/api/s5/s5.go +++ b/api/s5/s5.go @@ -1238,8 +1238,10 @@ func (s *S5API) pinEntity(ctx context.Context, userId uint, userIp string, cid * } if !isCidManifest(cid) { - if limitedReader.N >= 0 && uint64(len(data)) != cid.Size { - return nil, false + if limitedReader.N > 0 { + if uint64(len(data)) != cid.Size { + return nil, false + } } } else { dataCont, err := io.ReadAll(res.Body)