mirror of
https://github.com/minio/minio.git
synced 2024-12-23 21:55:53 -05:00
s3zip: Limit over-read for single file (#16161)
This commit is contained in:
parent
1cd875de1e
commit
98cffbce03
@ -179,8 +179,13 @@ func (api objectAPIHandlers) getObjectInArchiveFileHandler(ctx context.Context,
|
||||
var rc io.ReadCloser
|
||||
|
||||
if file.UncompressedSize64 > 0 {
|
||||
// We do not know where the file ends, but the returned reader only returns UncompressedSize.
|
||||
rs := &HTTPRangeSpec{Start: file.Offset, End: -1}
|
||||
// There may be number of header bytes before the content.
|
||||
// Reading 64K extra. This should more than cover name and any "extra" details.
|
||||
end := file.Offset + int64(file.CompressedSize64) + 64<<10
|
||||
if end > zipObjInfo.Size {
|
||||
end = zipObjInfo.Size
|
||||
}
|
||||
rs := &HTTPRangeSpec{Start: file.Offset, End: end}
|
||||
gr, err := objectAPI.GetObjectNInfo(ctx, bucket, zipPath, rs, nil, readLock, opts)
|
||||
if err != nil {
|
||||
writeErrorResponse(ctx, w, toAPIError(ctx, err), r.URL)
|
||||
|
Loading…
Reference in New Issue
Block a user