From e55f8d731cb4343f4be9361525221d8752fa75a6 Mon Sep 17 00:00:00 2001 From: Harshavardhana Date: Fri, 26 Nov 2021 02:20:32 -0800 Subject: [PATCH] support GetObject() on specific partNumber (#1591) --- api-get-object.go | 4 ++++ api-get-options.go | 1 + 2 files changed, 5 insertions(+) diff --git a/api-get-object.go b/api-get-object.go index b9b960250..2ce4b260f 100644 --- a/api-get-object.go +++ b/api-get-object.go @@ -24,6 +24,7 @@ import ( "io" "net/http" "net/url" + "strconv" "sync" "github.com/minio/minio-go/v7/pkg/s3utils" @@ -652,6 +653,9 @@ func (c *Client) getObject(ctx context.Context, bucketName, objectName string, o if opts.VersionID != "" { urlValues.Set("versionId", opts.VersionID) } + if opts.PartNumber > 0 { + urlValues.Set("partNumber", strconv.Itoa(opts.PartNumber)) + } // Execute GET on objectName. resp, err := c.executeMethod(ctx, http.MethodGet, requestMetadata{ diff --git a/api-get-options.go b/api-get-options.go index 0be858d19..184ef9f86 100644 --- a/api-get-options.go +++ b/api-get-options.go @@ -37,6 +37,7 @@ type GetObjectOptions struct { headers map[string]string ServerSideEncryption encrypt.ServerSide VersionID string + PartNumber int // To be not used by external applications Internal AdvancedGetOptions }