@@ -18,22 +18,27 @@ import getS3Config from '../utils/config.js';
1818import formatList from '../utils/list.js' ;
1919
2020function buildInput ( {
21- bucket, org, key, maxKeys,
21+ bucket, org, key, maxKeys, continuationToken ,
2222} ) {
2323 const input = {
2424 Bucket : bucket ,
2525 Prefix : key ? `${ org } /${ key } /` : `${ org } /` ,
2626 Delimiter : '/' ,
2727 } ;
2828 if ( maxKeys ) input . MaxKeys = maxKeys ;
29+ if ( continuationToken ) input . ContinuationToken = continuationToken ;
2930 return input ;
3031}
3132
3233export default async function listObjects ( env , daCtx , maxKeys ) {
3334 const config = getS3Config ( env ) ;
3435 const client = new S3Client ( config ) ;
3536
36- const input = buildInput ( { ...daCtx , maxKeys } ) ;
37+ const input = buildInput ( {
38+ ...daCtx ,
39+ maxKeys,
40+ continuationToken : daCtx . continuationToken ,
41+ } ) ;
3742 const command = new ListObjectsV2Command ( input ) ;
3843 try {
3944 const resp = await client . send ( command ) ;
@@ -43,6 +48,7 @@ export default async function listObjects(env, daCtx, maxKeys) {
4348 body : JSON . stringify ( body ) ,
4449 status : resp . $metadata . httpStatusCode ,
4550 contentType : resp . ContentType ,
51+ continuationToken : resp . NextContinuationToken ,
4652 } ;
4753 } catch ( e ) {
4854 return { body : '' , status : 404 } ;
0 commit comments