Skip to content

Commit

Permalink
fix: don't send 0 max items for object version and multipart upload p…
Browse files Browse the repository at this point in the history
…aginators (#2380)
  • Loading branch information
lucix-aws committed Nov 20, 2023
1 parent b3e07aa commit 3bd97c0
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 4 deletions.
8 changes: 8 additions & 0 deletions .changelog/4cd717be00794de68b972017a420472c.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"id": "4cd717be-0079-4de6-8b97-2017a420472c",
"type": "bugfix",
"description": "Don't send MaxKeys/MaxUploads=0 when unspecified in ListObjectVersions and ListMultipartUploads paginators.",
"modules": [
"service/s3"
]
}
16 changes: 12 additions & 4 deletions service/s3/handwritten_paginators.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,9 @@ func NewListObjectVersionsPaginator(client ListObjectVersionsAPIClient, params *
}

options := ListObjectVersionsPaginatorOptions{}
options.Limit = aws.ToInt32(params.MaxKeys)
if params.MaxKeys != nil {
options.Limit = aws.ToInt32(params.MaxKeys)
}

for _, fn := range optFns {
fn(&options)
Expand Down Expand Up @@ -79,7 +81,9 @@ func (p *ListObjectVersionsPaginator) NextPage(ctx context.Context, optFns ...fu
if p.options.Limit > 0 {
limit = p.options.Limit
}
params.MaxKeys = aws.Int32(limit)
if limit > 0 {
params.MaxKeys = aws.Int32(limit)
}

result, err := p.client.ListObjectVersions(ctx, &params, optFns...)
if err != nil {
Expand Down Expand Up @@ -143,7 +147,9 @@ func NewListMultipartUploadsPaginator(client ListMultipartUploadsAPIClient, para
}

options := ListMultipartUploadsPaginatorOptions{}
options.Limit = aws.ToInt32(params.MaxUploads)
if params.MaxUploads != nil {
options.Limit = aws.ToInt32(params.MaxUploads)
}

for _, fn := range optFns {
fn(&options)
Expand Down Expand Up @@ -178,7 +184,9 @@ func (p *ListMultipartUploadsPaginator) NextPage(ctx context.Context, optFns ...
if p.options.Limit > 0 {
limit = p.options.Limit
}
params.MaxUploads = aws.Int32(limit)
if limit > 0 {
params.MaxUploads = aws.Int32(limit)
}

result, err := p.client.ListMultipartUploads(ctx, &params, optFns...)
if err != nil {
Expand Down

0 comments on commit 3bd97c0

Please sign in to comment.