Skip to content

A fully open source & end-to-end encrypted note taking alternative to Evernote.

core: handle unknown collection types in sync (#9878)

01zulfi4dcf14fce1c4
diff --git a/packages/core/src/api/sync/index.ts b/packages/core/src/api/sync/index.ts
index d0fef7eec..aec8fb1ea 100644
--- a/packages/core/src/api/sync/index.ts
+++ b/packages/core/src/api/sync/index.ts
@@ -400,6 +400,16 @@ export class Sync {
}
const collectionType = SYNC_COLLECTIONS_MAP[itemType];
+
+ if (!collectionType) {
+ this.logger.error(
+ new Error(
+ `Unknown collection type for item type ${itemType}. Skipping chunk.`
+ )
+ );
+ return;
+ }
+
const collection = this.db[collectionType].collection;
const localItems = await collection.records(chunk.items.map((i) => i.id));
let items: (MaybeDeletedItem<Item> | undefined)[] = [];