mirror of
https://github.com/minio/minio.git
synced 2025-11-29 13:28:17 -05:00
XL: fix getBlockInfo() to return correct end block (#1941)
If requested offset/length of an object is equal to erasureInfo.BlockSize, getBlockInfo() returns one more block added to actual end block. This patch fixes the issue. This patch also adds unit test for get objects with big files.
This commit is contained in:
@@ -96,6 +96,9 @@ func getBlockInfo(offset, length, blockSize int64) (startBlock, bytesToSkip, end
|
||||
|
||||
// Calculate end block for given size to read
|
||||
endBlock = (offset + length) / blockSize
|
||||
if endBlock > 0 && (offset+length)%blockSize == 0 {
|
||||
endBlock--
|
||||
}
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user