diff --git a/packages/storage/__tests__/providers/s3/utils/client/S3/cases/copyObject.ts b/packages/storage/__tests__/providers/s3/utils/client/S3/cases/copyObject.ts index c20c0394a0e..8938a2ce9c8 100644 --- a/packages/storage/__tests__/providers/s3/utils/client/S3/cases/copyObject.ts +++ b/packages/storage/__tests__/providers/s3/utils/client/S3/cases/copyObject.ts @@ -37,7 +37,7 @@ const copyObjectHappyCase: ApiFunctionalTestCase = [ 'content-type': 'contentType', 'x-amz-acl': 'acl', 'x-amz-copy-source-if-match': 'eTag', - 'x-amz-copy-source-if-unmodified-since': '1970-01-01T00:00:00.000Z', + 'x-amz-copy-source-if-unmodified-since': 'Thu, 01 Jan 1970 00:00:00 GMT', }), }), { diff --git a/packages/storage/__tests__/providers/s3/utils/client/s3Data/copyObject.test.ts b/packages/storage/__tests__/providers/s3/utils/client/s3Data/copyObject.test.ts index bef1281e62c..01ce54eb16f 100644 --- a/packages/storage/__tests__/providers/s3/utils/client/s3Data/copyObject.test.ts +++ b/packages/storage/__tests__/providers/s3/utils/client/s3Data/copyObject.test.ts @@ -114,7 +114,8 @@ describe('validateCopyObjectHeaders', () => { ...baseHeaders, 'x-amz-metadata-directive': 'mock-metadata', 'x-amz-copy-source-if-match': 'mock-etag', - 'x-amz-copy-source-if-unmodified-since': '1970-01-01T00:00:00.000Z', + 'x-amz-copy-source-if-unmodified-since': + 'Thu, 01 Jan 1970 00:00:00 GMT', }, expectPass: true, }, @@ -125,7 +126,8 @@ describe('validateCopyObjectHeaders', () => { ...baseHeaders, 'x-amz-metadata-directive': 'mock-metadata', 'x-amz-copy-source-if-match': 'mock-etag', - 'x-amz-copy-source-if-unmodified-since': '1970-01-01T00:00:00.000Z', + 'x-amz-copy-source-if-unmodified-since': + 'Thu, 01 Jan 1970 00:00:00 GMT', }, expectPass: false, }, diff --git a/packages/storage/src/providers/s3/utils/client/s3data/copyObject.ts b/packages/storage/src/providers/s3/utils/client/s3data/copyObject.ts index 3e65ab03671..f1dd2784d13 100644 --- a/packages/storage/src/providers/s3/utils/client/s3data/copyObject.ts +++ b/packages/storage/src/providers/s3/utils/client/s3data/copyObject.ts @@ -59,7 +59,7 @@ const copyObjectSerializer = async ( 'x-amz-metadata-directive': input.MetadataDirective, 'x-amz-copy-source-if-match': input.CopySourceIfMatch, 'x-amz-copy-source-if-unmodified-since': - input.CopySourceIfUnmodifiedSince?.toISOString(), + input.CopySourceIfUnmodifiedSince?.toUTCString(), 'x-amz-source-expected-bucket-owner': input.ExpectedSourceBucketOwner, 'x-amz-expected-bucket-owner': input.ExpectedBucketOwner, }), @@ -96,7 +96,7 @@ export const validateCopyObjectHeaders = ( headers['x-amz-copy-source-if-match'], ), bothNilOrEqual( - input.CopySourceIfUnmodifiedSince?.toISOString(), + input.CopySourceIfUnmodifiedSince?.toUTCString(), headers['x-amz-copy-source-if-unmodified-since'], ), ];