Skip to content

Commit

Permalink
Merge branch 'w/8.6/bugfix/CLDSRV-462/tags' into tmp/octopus/w/8.7/bu…
Browse files Browse the repository at this point in the history
…gfix/CLDSRV-462/tags
  • Loading branch information
bert-e committed Oct 25, 2023
2 parents 41d6365 + c96706f commit 2df9a57
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 2 deletions.
6 changes: 4 additions & 2 deletions lib/api/apiUtils/object/expirationHeaders.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,10 @@ const AMZ_ABORT_ID_HEADER = 'x-amz-abort-rule-id';

function _generateExpHeadersObjects(rules, params, datetime) {
const tags = {
TagSet: Object.keys(params.tags)
.map(key => ({ Key: key, Value: params.tags[key] })),
TagSet: params.tags
? Object.keys(params.tags)
.map(key => ({ Key: key, Value: params.tags[key] }))
: [],
};

const objectInfo = { Key: params.key };
Expand Down
10 changes: 10 additions & 0 deletions tests/unit/api/apiUtils/expirationHeaders.js
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,16 @@ describe('generateExpirationHeaders', () => {
},
{},
],
[
'should provide correct headers for compatibility with legacy objects missing the tags property',
{
lifecycleConfig: lifecycleExpirationDays,
objectParams: { key: 'object', date: objectDate },
},
{
'x-amz-expiration': `expiry-date="${expectedDaysExpiryDate}", rule-id="test-days"`,
},
],
[
'should return correct headers for object (days)',
{
Expand Down

0 comments on commit 2df9a57

Please sign in to comment.