aws-amplify / amplify-js

A declarative JavaScript library for application development using cloud services.
https://docs.amplify.aws/lib/q/platform/js
Apache License 2.0
9.41k stars 2.12k forks source link

Support for Content-MD5 header irrespective of objectlock. #13395

Open sushpatg opened 3 months ago

sushpatg commented 3 months ago

Is this related to a new or existing framework?

React

Is this related to a new or existing API?

Storage

Is this related to another service?

No response

Describe the feature you'd like to request

To add ContentMD5 header while making request irrespective of objectlock.

Describe the solution you'd like

Currently we have Pull request - 11611 where Content-MD5 header is supported when ObjectLock is enabled.

I was able to see ContentMD5header if isObjectLockEnabled: true in Storage.configure(). But have not enabled object lock for S3 bucket.

Looking for solution to pass pass ContentMD5 header irrespective of objectlock.

Describe alternatives you've considered

I was able to see ContentMD5header if isObjectLockEnabled: true in Storage.configure(). But have not enabled object lock for S3 bucket.


Amplify.configure(config);
Storage.configure(
  {
    AWSS3:
    {
      bucket: config.aws_user_files_s3_bucket, //REQUIRED -  Amazon S3 bucket name
      region: config.aws_user_files_s3_bucket_region, //OPTIONAL -  Amazon service region
      isObjectLockEnabled: true
    }
  }
)

Additional context

No response

Is this something that you'd be interested in working on?

HuiSF commented 3 months ago

Hi @sushpatg thanks for making this feature request. In your use cases, do you compute the MD5 digest yourself?

cwomack commented 3 months ago

@sushpatg, can you confirm that what's being asked for in this issue is support of the ContentMD5 option within Storage (as detailed here in v5 docs) for the v6 uploadData API? Or was there another use case or API that you're trying to use for this?

sushpatg commented 3 months ago

@cwomack, as per my testing ContentMD5 does not work even in v5 unless one has configured isObjectLockEnabled to true.

Also as per the below excerpt from S3 documentation, we should be able to pass ContentMD5 header manually(calculated outside) or if not passed amplify-js should calculate it for us

When you upload an object, you can optionally include a precalculated checksum as part of your request. Amazon S3 compares the provided checksum to the checksum that it calculates by using your specified algorithm. If the two values don't match, Amazon S3 reports an error
sushpatg commented 3 months ago

Hi @sushpatg thanks for making this feature request. In your use cases, do you compute the MD5 digest yourself?

Yes, we can calculate it ourselves