Skip to content

Store checksum algorithm and type on S3 multipart uploads #9024

@Lucidiot

Description

@Lucidiot

I tried to use Moto to assert that a multipart upload was created through s3.Object.initiate_multipart_upload correctly, with a ChecksumAlgorithm and a ChecksumType set, but I found that the checksum parameters are not stored in the mock's state and not returned:

import boto3
from moto import mock_aws

with mock_aws():
    s3 = boto3.resource("s3", region_name="us-east-1")
    bucket = s3.create_bucket(Bucket="bucket")

    s3.Object("bucket", "key").initiate_multipart_upload(
        ChecksumAlgorithm="SHA256",
        ChecksumType="COMPOSITE",
    )
    upload, = bucket.multipart_uploads.all()

    # Expected: upload.checksum_algorithm=SHA256 upload.checksum_type=COMPOSITE
    # Actual: upload.checksum_algorithm=None upload.checksum_type=None
    print(f"{upload.checksum_algorithm=} {upload.checksum_type=}")

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions