Skip to content

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

core: fix `Cannot read properties of null (reading 'length')` in migration

Abdullah Attad88d07a2b06c
diff --git a/packages/core/src/migrations.ts b/packages/core/src/migrations.ts
index 948fbe32e..9d515f925 100644
--- a/packages/core/src/migrations.ts
+++ b/packages/core/src/migrations.ts
@@ -247,6 +247,8 @@ const migrations: Migration[] = [
},
note: async (item, db) => {
for (const tag of item.tags || []) {
+ if (!tag) continue;
+
const oldTagId = makeId(tag);
const oldTag = db.legacyTags.get(oldTagId);
const alias = db.legacySettings.getAlias(oldTagId);
diff --git a/packages/core/src/types.ts b/packages/core/src/types.ts
index eb5283a24..bae8b0fdf 100644
--- a/packages/core/src/types.ts
+++ b/packages/core/src/types.ts
@@ -171,7 +171,7 @@ export interface Note extends BaseItem<"note"> {
/**
* @deprecated only kept here for migration purposes.
*/
- tags?: string[];
+ tags?: (string | null)[];
/**
* @deprecated only kept here for migration purposes.
*/