File tree 1 file changed +11
-34
lines changed 1 file changed +11
-34
lines changed Original file line number Diff line number Diff line change @@ -358,48 +358,25 @@ export const checkS3Object = async (
358
358
root : string ,
359
359
path ?: string
360
360
) : Promise < void > => {
361
+ console . log ( path , root ) ;
361
362
// checking the existance of an S3 object
362
363
if ( path ) {
363
- try {
364
- await s3Client . send (
365
- new HeadObjectCommand ( {
366
- Bucket : bucketName ,
367
- Key : PathExt . join ( root , path )
368
- } )
369
- ) ;
370
- } catch {
371
- Promise . reject ( ) ;
372
- }
373
- } else {
374
- // checking if the root folder exists
375
- const rootInfo = await s3Client . send (
364
+ await s3Client . send (
365
+ new HeadObjectCommand ( {
366
+ Bucket : bucketName ,
367
+ Key : PathExt . join ( root , path )
368
+ } )
369
+ ) ;
370
+ }
371
+ // checking if the root folder exists
372
+ else {
373
+ await s3Client . send (
376
374
new ListObjectsV2Command ( {
377
375
Bucket : bucketName ,
378
376
Prefix : root + '/'
379
377
} )
380
378
) ;
381
-
382
- if ( rootInfo . Contents ! . length > 0 ) {
383
- Promise . resolve ( ) ;
384
- } else {
385
- Promise . reject ( ) ;
386
- }
387
379
}
388
- // try {
389
- // await s3Client.send(
390
- // new HeadObjectCommand({
391
- // Bucket: bucketName,
392
- // Key: path ? PathExt.join(root, path) : root + '/' // check whether we are looking at an object or the root
393
- // })
394
- // );
395
- // } catch (error) {
396
- // await s3Client.send(
397
- // new HeadObjectCommand({
398
- // Bucket: bucketName,
399
- // Key: path ? PathExt.join(root, path) : root + '/.emptyFolderPlaceholder' // check whether we are looking at an object or the root
400
- // })
401
- // );
402
- // }
403
380
} ;
404
381
405
382
/**
You can’t perform that action at this time.
0 commit comments