You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The current version of moto requires the Content-Md5 header to be provided when uploading an object with a retention configured using object lock. However the AWS documentation specifies that the x-amz-sdk-checksum-algorithm header may be provided instead (AWS doc reference). I can confirm that the documentation is accurate after having performed a couple tests including the latter header instead of the content md5 one.
This issue is relevant since botocore does not compute and include the content md5 automatically since version 1.36.0, see changelog.
To fix this issue only a couple changes are required:
First in moto/s3/exceptions.py, the InvalidContentMD5 exception can be replaced by a new more descriptive one like:
class MissingUploadObjectWithObjectLockHeaders(S3ClientError):
code = 400
def __init__(self) -> None:
super().__init__("MissingUploadObjectWithObjectLockHeaders", "Content-MD5 or x-amz-sdk-checksum-algorithm header required to upload an object with a retention period configured using Object Lock")
And in moto/s3/responses.py, in the _key_response_put method, the block that checks the headers can be updated to:
if lock_mode or lock_until or legal_hold == "ON":
if not self.headers.get("Content-Md5") and not self.headers.get("x-amz-sdk-checksum-algorithm"):
raise MissingUploadObjectWithObjectLockHeaders
if not lock_enabled:
raise LockNotEnabled
elif lock_enabled and bucket.has_default_lock:
if not self.headers.get("Content-Md5") and not self.headers.get("x-amz-sdk-checksum-algorithm"):
raise MissingUploadObjectWithObjectLockHeaders
The text was updated successfully, but these errors were encountered:
Hi ;)
The current version of moto requires the
Content-Md5
header to be provided when uploading an object with a retention configured using object lock. However the AWS documentation specifies that thex-amz-sdk-checksum-algorithm
header may be provided instead (AWS doc reference). I can confirm that the documentation is accurate after having performed a couple tests including the latter header instead of the content md5 one.This issue is relevant since botocore does not compute and include the content md5 automatically since version 1.36.0, see changelog.
To fix this issue only a couple changes are required:
First in
moto/s3/exceptions.py
, theInvalidContentMD5
exception can be replaced by a new more descriptive one like:And in
moto/s3/responses.py
, in the_key_response_put
method, the block that checks the headers can be updated to:The text was updated successfully, but these errors were encountered: