Fix s3 driver empty objects (#19361)

`undefined === 0` breaks the early return
This commit is contained in:
Paul Rastoin
2026-04-07 10:20:56 +02:00
committed by GitHub
parent 2d552fc9fd
commit 601dc02ed7

View File

@@ -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 };
}),
},