Skip to content

Commit 9be98ca

Browse files
committed
Support ListObjectsV2Extended without Query parameter
Issue: CLDSRVCLT-11
1 parent af66ea9 commit 9be98ca

2 files changed

Lines changed: 11 additions & 5 deletions

File tree

src/commands/s3Extended/listObjectsV2.ts

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,10 +29,12 @@ export class ListObjectsV2ExtendedCommand extends ListObjectsV2Command {
2929
constructor(input: ListObjectsV2ExtendedInput) {
3030
super(input);
3131

32-
this.middlewareStack.add(
33-
extendCommandWithExtraParametersMiddleware(input.Query),
34-
{ step: 'build', name: 'extendCommandWithExtraParameters' }
35-
);
32+
if (input.Query) {
33+
this.middlewareStack.add(
34+
extendCommandWithExtraParametersMiddleware(input.Query),
35+
{ step: 'build', name: 'extendCommandWithExtraParameters' }
36+
);
37+
}
3638

3739
if (input.ObjectAttributes?.length) {
3840
const captured = { xml: '' };

tests/commands/s3Extended/listObjectsV2.test.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ describeForMongoBackend('ListObjectsV2Extended', () => {
4949
assert.strictEqual(getData2.Contents[0].Key, key2ndObject);
5050
});
5151

52-
describe.skip('ListObjectsV2 with ObjectAttributes', () => {
52+
describe('ListObjectsV2 with ObjectAttributes', () => {
5353
const metaKey1 = `${testConfig.objectKey}-listv2-meta1`;
5454
const metaKey2 = `${testConfig.objectKey}-listv2-meta2`;
5555

@@ -71,6 +71,7 @@ describeForMongoBackend('ListObjectsV2Extended', () => {
7171
it('should list objects with a single user metadata key', async () => {
7272
const result = await s3client.send(new ListObjectsV2ExtendedCommand({
7373
Bucket: testConfig.bucketName,
74+
Prefix: `${testConfig.objectKey}-listv2-meta`,
7475
ObjectAttributes: ['x-amz-meta-foo'],
7576
})) as ListObjectsV2ExtendedOutput;
7677

@@ -117,6 +118,7 @@ describeForMongoBackend('ListObjectsV2Extended', () => {
117118
it('should list objects with non-existing user metadata key', async () => {
118119
const result = await s3client.send(new ListObjectsV2ExtendedCommand({
119120
Bucket: testConfig.bucketName,
121+
Prefix: `${testConfig.objectKey}-listv2-meta`,
120122
ObjectAttributes: ['x-amz-meta-nonexistent'],
121123
})) as ListObjectsV2ExtendedOutput;
122124

@@ -130,6 +132,7 @@ describeForMongoBackend('ListObjectsV2Extended', () => {
130132
it('should list objects with RestoreStatus combined with user metadata', async () => {
131133
const result = await s3client.send(new ListObjectsV2ExtendedCommand({
132134
Bucket: testConfig.bucketName,
135+
Prefix: `${testConfig.objectKey}-listv2-meta`,
133136
ObjectAttributes: ['RestoreStatus', 'x-amz-meta-foo'],
134137
})) as ListObjectsV2ExtendedOutput;
135138

@@ -143,6 +146,7 @@ describeForMongoBackend('ListObjectsV2Extended', () => {
143146
it('should list objects with RestoreStatus combined with non-existing user metadata', async () => {
144147
const result = await s3client.send(new ListObjectsV2ExtendedCommand({
145148
Bucket: testConfig.bucketName,
149+
Prefix: `${testConfig.objectKey}-listv2-meta`,
146150
ObjectAttributes: ['RestoreStatus', 'x-amz-meta-nonexistent'],
147151
})) as ListObjectsV2ExtendedOutput;
148152

0 commit comments

Comments
 (0)