1
0
mirror of https://github.com/laurent22/joplin.git synced 2024-12-24 10:27:10 +02:00

Desktop,Mobile,Cli: Fixes #8891: Fix AWS S3 sync error (#9696)

This commit is contained in:
Henry Heino 2024-01-11 13:22:42 -08:00 committed by GitHub
parent 9a68157b86
commit 150ee7631e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -175,6 +175,12 @@ class FileApiDriverAmazonS3 {
}
metadataToStats_(mds) {
// aws-sdk-js-v3 can rerturn undefined instead of an empty array when there is
// no metadata in some cases.
//
// Thus, we handle the !mds case.
if (!mds) return [];
const output = [];
for (let i = 0; i < mds.length; i++) {
output.push(this.metadataToStat_(mds[i], mds[i].Key));
@ -212,10 +218,6 @@ class FileApiDriverAmazonS3 {
let response = await this.s3ListObjects(prefixPath);
// In aws-sdk-js-v3 if there are no contents it no longer returns
// an empty array. This creates an Empty array to pass onward.
if (response.Contents === undefined) response.Contents = [];
let output = this.metadataToStats_(response.Contents, prefixPath);
while (response.IsTruncated) {