diff --git a/.changelog/4cd717be00794de68b972017a420472c.json b/.changelog/4cd717be00794de68b972017a420472c.json new file mode 100644 index 00000000000..31ead3461ca --- /dev/null +++ b/.changelog/4cd717be00794de68b972017a420472c.json @@ -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" + ] +} \ No newline at end of file diff --git a/service/s3/handwritten_paginators.go b/service/s3/handwritten_paginators.go index 02128da6ff8..6aae79e7cac 100644 --- a/service/s3/handwritten_paginators.go +++ b/service/s3/handwritten_paginators.go @@ -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) @@ -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, ¶ms, optFns...) if err != nil { @@ -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) @@ -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, ¶ms, optFns...) if err != nil {