terricain / aioboto3

Wrapper to use boto3 resources with the aiobotocore async backend
Apache License 2.0
743 stars 76 forks source link

S3 same ExtraArgs for upload_fileobj and get_object in method copy #331

Open MarchenkoRoman opened 5 months ago

MarchenkoRoman commented 5 months ago

Description

I tried to copy file object in S3 using copy method, but found get_object and upload_fileobj in method used the same ExtraArgs, but according to boto3 documentation https://boto3.amazonaws.com/v1/documentation/api/latest/reference/customizations/s3.html#boto3.s3.transfer.S3Transfer its must be different

I think better use different ExtraArgs for get_object and upload_fileobj when its use in copy method for example:

     async with s3_client as s3:
         await s3.copy(
             CopySource={'Bucket': settings.S3.BUCKET, 'Key': key},
             Bucket=settings.S3.BUCKET,
             Key='new_tmp/' + key,
             ExtraArgs={'ACL': 'public-read'}
         )

will raise

ParamValidationError: Parameter validation failed:
Unknown parameter in input: "ACL", must be one of: Bucket, IfMatch, IfModifiedSince, IfNoneMatch, IfUnmodifiedSince, Key, Range, ResponseCacheControl, ResponseContentDisposition, ResponseContentEncoding, ResponseContentLanguage, ResponseContentType, ResponseExpires, VersionId, SSECustomerAlgorithm, SSECustomerKey, SSECustomerKeyMD5, RequestPayer, PartNumber, ExpectedBucketOwner, ChecksumMode
terricain commented 4 months ago

Try v13.0.0 this should be resolved now.