mirror of
https://github.com/twentyhq/twenty.git
synced 2026-05-24 08:22:01 -04:00
Fix s3 driver empty objects (#19361)
`undefined === 0` breaks the early return
This commit is contained in:
@@ -443,12 +443,16 @@ export class S3Driver implements StorageDriver {
|
||||
private async emptyS3Directory(folderPath: string) {
|
||||
const listedObjects = await this.fetchS3FolderContents(folderPath);
|
||||
|
||||
if (listedObjects.Contents?.length === 0) return;
|
||||
if (
|
||||
!isDefined(listedObjects.Contents) ||
|
||||
listedObjects.Contents.length === 0
|
||||
)
|
||||
return;
|
||||
|
||||
const deleteParams = {
|
||||
Bucket: this.bucketName,
|
||||
Delete: {
|
||||
Objects: listedObjects.Contents?.map(({ Key }) => {
|
||||
Objects: listedObjects.Contents.map(({ Key }) => {
|
||||
return { Key };
|
||||
}),
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user