From 5352c7b8282d7ae7be710838fa0aa41e73c23ff9 Mon Sep 17 00:00:00 2001 From: fyears Date: Mon, 8 Nov 2021 09:37:51 +0800 Subject: [PATCH] check undefined --- src/s3.ts | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/s3.ts b/src/s3.ts index 4217678..f793936 100644 --- a/src/s3.ts +++ b/src/s3.ts @@ -149,6 +149,9 @@ export const listFromRemote = async ( if (rsp.$metadata.httpStatusCode !== 200) { throw Error("some thing bad while listing remote!"); } + if (rsp.Contents === undefined) { + break; + } contents.push(...rsp.Contents); isTruncated = rsp.IsTruncated;