From 76239fa1ae58041fdb4eea5911ec1d38ed6ac83b Mon Sep 17 00:00:00 2001 From: Klaus Post Date: Thu, 14 Oct 2021 12:37:30 -0700 Subject: [PATCH] Fix s3zip not returning data (#13442) We do not reliably know the length of compressed data, including headers. Request until the end-of-stream. Results will still be properly truncated. Fixes #13441 --- cmd/s3-zip-handlers.go | 3 ++- go.mod | 2 +- go.sum | 4 ++-- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/cmd/s3-zip-handlers.go b/cmd/s3-zip-handlers.go index b36bea866..cb3575817 100644 --- a/cmd/s3-zip-handlers.go +++ b/cmd/s3-zip-handlers.go @@ -173,7 +173,8 @@ func (api objectAPIHandlers) getObjectInArchiveFileHandler(ctx context.Context, var rc io.ReadCloser if file.UncompressedSize64 > 0 { - rs := &HTTPRangeSpec{Start: file.Offset, End: file.Offset + int64(file.UncompressedSize64) - 1} + // We do not know where the file ends, but the returned reader only returns UncompressedSize. + rs := &HTTPRangeSpec{Start: file.Offset, End: -1} gr, err := objectAPI.GetObjectNInfo(ctx, bucket, zipPath, rs, nil, readLock, opts) if err != nil { writeErrorResponse(ctx, w, toAPIError(ctx, err), r.URL) diff --git a/go.mod b/go.mod index d655cbdea..500a5032b 100644 --- a/go.mod +++ b/go.mod @@ -54,7 +54,7 @@ require ( github.com/minio/sha256-simd v1.0.0 github.com/minio/simdjson-go v0.2.1 github.com/minio/sio v0.3.0 - github.com/minio/zipindex v0.2.0 + github.com/minio/zipindex v0.2.1 github.com/mitchellh/go-homedir v1.1.0 github.com/montanaflynn/stats v0.6.6 github.com/nats-io/nats-server/v2 v2.3.2 diff --git a/go.sum b/go.sum index 9d4c806e7..c5e6aef8f 100644 --- a/go.sum +++ b/go.sum @@ -1056,8 +1056,8 @@ github.com/minio/simdjson-go v0.2.1/go.mod h1:JPUSkRykfSPS+AhO0YPA1h0l5vY7NqrF4z github.com/minio/sio v0.2.1/go.mod h1:8b0yPp2avGThviy/+OCJBI6OMpvxoUuiLvE6F1lebhw= github.com/minio/sio v0.3.0 h1:syEFBewzOMOYVzSTFpp1MqpSZk8rUNbz8VIIc+PNzus= github.com/minio/sio v0.3.0/go.mod h1:8b0yPp2avGThviy/+OCJBI6OMpvxoUuiLvE6F1lebhw= -github.com/minio/zipindex v0.2.0 h1:iqgIhPkYnZ6fNd6q8trtJc8+mtKJNFTaxXlNw4n0We8= -github.com/minio/zipindex v0.2.0/go.mod h1:s+b/Qyw9JtSEnYfaM4ASOWNO2xGnXCfzQ+SWAzVkVZc= +github.com/minio/zipindex v0.2.1 h1:A37vDQJ7Uyp4RHpQEEpintgiIxg0t3npH2CWjLT//u4= +github.com/minio/zipindex v0.2.1/go.mod h1:s+b/Qyw9JtSEnYfaM4ASOWNO2xGnXCfzQ+SWAzVkVZc= github.com/mitchellh/cli v1.0.0/go.mod h1:hNIlj7HEI86fIcpObd7a0FcrxTWetlwJDGcceTlRvqc= github.com/mitchellh/copystructure v1.0.0/go.mod h1:SNtv71yrdKgLRyLFxmLdkAbkKEFWgYaq1OVrnRcwhnw= github.com/mitchellh/go-homedir v1.0.0/go.mod h1:SfyaCUpYCn1Vlf4IUYiD9fPX4A5wJrkLzIz1N1q0pr0=