Skip to content

Commit

Permalink
fix(storage): bug in copy unmodified since to use UTC (#14025)
Browse files Browse the repository at this point in the history
fix to use UTC and test
  • Loading branch information
ashika112 authored Nov 20, 2024
1 parent 34fba2d commit 38a0b53
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ const copyObjectHappyCase: ApiFunctionalTestCase<typeof copyObject> = [
'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',
}),
}),
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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,
},
Expand All @@ -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,
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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,
}),
Expand Down Expand Up @@ -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'],
),
];
Expand Down

0 comments on commit 38a0b53

Please sign in to comment.