Skip to content

Commit

Permalink
support GetObject() on specific partNumber (#1591)
Browse files Browse the repository at this point in the history
  • Loading branch information
harshavardhana authored Nov 26, 2021
1 parent bc3d8f7 commit e55f8d7
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
4 changes: 4 additions & 0 deletions api-get-object.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ import (
"io"
"net/http"
"net/url"
"strconv"
"sync"

"github.com/minio/minio-go/v7/pkg/s3utils"
Expand Down Expand Up @@ -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{
Expand Down
1 change: 1 addition & 0 deletions api-get-options.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down

0 comments on commit e55f8d7

Please sign in to comment.