mock-aws-s3 icon indicating copy to clipboard operation
mock-aws-s3 copied to clipboard

Support for ContinuationToken?

Open adrian-kriegel opened this issue 2 years ago • 1 comments

I have noticed that listObjectsV2 does not return NextContinuationToken which is required when iterating through larger sets of objects on S3. The response looks like this:

{
      Contents: [
        {
          Key: 'file_0',
          ETag: '"cc6c6102174b3050bc3397c724f00f63"',
          LastModified: 2022-08-17T13:10:29.351Z,
          Size: 3
        },
        {
          Key: 'file_1',
          ETag: '"cc6c6102174b3050bc3397c724f00f63"',
          LastModified: 2022-08-17T13:10:29.351Z,
          Size: 3
        }
      ],
      CommonPrefixes: [ { Prefix: '/' } ],
      IsTruncated: true,
      NextContinuationToken: undefined,
      ContinuationToken: undefined,
      StartAfter: undefined
}

Note that while the tokens are missing, isTruncated is still set to true, which would lead to an infinite loop in many applications.

adrian-kriegel avatar Aug 17 '22 13:08 adrian-kriegel

Looking at the code, this should be supported. But it requires Delimiter to be set to some arbitrary character.

mock.js line 228:

		if (truncated && search.Delimiter) {
			result.NextMarker = _.last(result.Contents).Key
		}

Is this also the behavior expected from AWS S3?

adrian-kriegel avatar Aug 17 '22 13:08 adrian-kriegel