-
Notifications
You must be signed in to change notification settings - Fork 80
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix for not accepting the past dates as expiration for bucket lifecycle rules #8633
base: master
Are you sure you want to change the base?
Conversation
Hey @achouhan09
|
…le rules Signed-off-by: Aayush Chouhan <[email protected]>
Hi @romayalon |
Signed-off-by: Aayush Chouhan <[email protected]>
@@ -44,6 +44,7 @@ exports.empty_filter_marker_lifecycle_configuration = empty_filter_marker_lifecy | |||
|
|||
function date_lifecycle_configuration(Bucket, Key) { | |||
const now = new Date(Date.now()); | |||
now.setDate(now.getDate() + 1); // Increases date by 1 day; past/current dates can't be set |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you change the name of the variable? as it is not "now" anymore... (I saw it in more places).
await s3.putBucketLifecycleConfiguration(putLifecycleParams) | ||
.catch(error => { | ||
assert(error.code === 'InvalidArgument', 'Expected InvalidArgument: expiration date in the past'); | ||
console.log('Expected error received, expiration date in the past'); | ||
}); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there a special reason for using the promise chain here?
@@ -63,8 +64,31 @@ function date_lifecycle_configuration(Bucket, Key) { | |||
} | |||
exports.date_lifecycle_configuration = date_lifecycle_configuration; | |||
|
|||
function past_date_lifecycle_configuration(Bucket, Key) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you reuse the previous definition of date_lifecycle_configuration
and make the change you need on this function's output?
Explain the changes
Issues: Fixed #xxx / Gap #xxx
Testing Instructions: