-
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
Added restriction to limit the ID length to 255 characters in bucket lifecycle rules #8628
base: master
Are you sure you want to change the base?
Conversation
Hey @achouhan09
|
…lifecycle rules Signed-off-by: Aayush Chouhan <[email protected]>
Hi @romayalon Added issue link and tests. Thanks |
Signed-off-by: Aayush Chouhan <[email protected]>
@@ -88,7 +88,12 @@ async function put_bucket_lifecycle(req) { | |||
}; | |||
|
|||
if (rule.ID?.length === 1) { | |||
current_rule.id = rule.ID[0]; | |||
if (rule.ID[0].length > 255) { |
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.
I'm suggesting to move the 255 to a const variable for easier reading of the code and maintenance - in case in the future it will be changed we need to change it in one place only, for example:
const MAX_LENGTH_RULE_ID = 255
and reuse it in the error message.
const putLifecycleParams = id_length_lifecycle_configuration(Bucket, Key); | ||
|
||
await s3.putBucketLifecycleConfiguration(putLifecycleParams) | ||
.catch(error => { |
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.
Why do you use a promise chain here?
Explain the changes
Issues: Fixed #xxx / Gap #xxx
Testing Instructions: