diff --git a/fluxer_api/src/api/migrate/S3FilesystemMigration.ts b/fluxer_api/src/api/migrate/S3FilesystemMigration.ts index 49d1fb466..424a3dca6 100644 --- a/fluxer_api/src/api/migrate/S3FilesystemMigration.ts +++ b/fluxer_api/src/api/migrate/S3FilesystemMigration.ts @@ -152,11 +152,13 @@ export interface StorageMigrationSource { function s3MigrationSource(client: S3Client): StorageMigrationSource { return { async *list(bucket) { + const seen = new Set(); let token: string | undefined; do { const page = await client.send(new ListObjectsV2Command({Bucket: bucket, ContinuationToken: token})); for (const object of page.Contents ?? []) { - if (object.Key === undefined) continue; + if (object.Key === undefined || seen.has(object.Key)) continue; + seen.add(object.Key); yield {key: object.Key, size: object.Size ?? 0, lastModified: object.LastModified}; } if (page.IsTruncated && !page.NextContinuationToken) {