Skip to content

Commit

Permalink
add condition to check limit for number of deleted objects
Browse files Browse the repository at this point in the history
Signed-off-by: nadav mizrahi <[email protected]>
  • Loading branch information
nadavMiz committed Apr 18, 2023
1 parent f4c47f1 commit 7b7abb1
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
7 changes: 7 additions & 0 deletions src/endpoint/s3/ops/s3_post_bucket_delete.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

const _ = require('lodash');
const dbg = require('../../../util/debug_module')(__filename);
const S3Error = require('../s3_errors').S3Error;

/**
* http://docs.aws.amazon.com/AmazonS3/latest/API/multiobjectdeleteapi.html
Expand All @@ -15,6 +16,12 @@ async function post_bucket_delete(req) {
key: obj.Key && obj.Key[0],
version_id: obj.VersionId && obj.VersionId[0],
}));

if (objects.length > 1000) {
dbg.error('cannot delete more than 1000 objects');
throw new S3Error(S3Error.MalformedXML);
}

dbg.log3('post_bucket_delete: objects', objects);

const reply = await req.object_sdk.delete_multiple_objects({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ s3tests_boto3.functional.test_s3.test_bucket_list_prefix_basic
s3tests_boto3.functional.test_s3.test_bucket_list_prefix_delimiter_basic
s3tests_boto3.functional.test_s3.test_account_usage
s3tests_boto3.functional.test_s3.test_head_bucket_usage
s3tests_boto3.functional.test_s3.test_multi_object_delete_key_limit
s3tests_boto3.functional.test_s3.test_post_object_invalid_signature
s3tests_boto3.functional.test_s3.test_post_object_invalid_access_key
s3tests_boto3.functional.test_s3.test_post_object_missing_policy_condition
Expand Down

0 comments on commit 7b7abb1

Please sign in to comment.