Skip to content

Commit ffa8634

Browse files
Updated the s3 error msg in InvalidArgument error
Signed-off-by: Aayush Chouhan <[email protected]>
1 parent eaf259a commit ffa8634

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed

src/endpoint/s3/ops/s3_put_bucket_lifecycle.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ async function put_bucket_lifecycle(req) {
9191
if (rule.ID?.length === 1) {
9292
if (rule.ID[0].length > config.MAX_RULE_ID_LENGTH) {
9393
dbg.error('Rule should not have ID length exceed allowed limit of ', config.MAX_RULE_ID_LENGTH, ' characters', rule);
94-
throw new S3Error(S3Error.InvalidArgument);
94+
throw new S3Error({ ...S3Error.InvalidArgument, message: 'ID length should not exceed allowed limit of 255' });
9595
} else {
9696
current_rule.id = rule.ID[0];
9797
}

src/test/lifecycle/common.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -523,6 +523,8 @@ exports.test_rule_id_length = async function(Bucket, Key, s3) {
523523

524524
try {
525525
await s3.putBucketLifecycleConfiguration(putLifecycleParams);
526+
// if no error occurs, explicitly fail the test
527+
assert.fail('Expected error for ID length exceeding maximum allowed characters, but request was successful');
526528
} catch (error) {
527529
assert(error.code === 'InvalidArgument', 'Expected InvalidArgument: id length exceeding 255 characters');
528530
console.log('Expected error received, id length exceeding', config.MAX_RULE_ID_LENGTH, 'characters');

0 commit comments

Comments
 (0)