Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: maxkeys incorrectly set to 0 #2380

Merged
merged 1 commit into from
Nov 20, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading