Skip to content

⚡️⚡️⚡️ Self-hosted collaborative bookmark manager to collect, read, annotate, and fully preserve what matters, all in one place.

Fix bookmark import issue with missing folder names

LeonKohli74030b26c534
diff --git a/lib/api/controllers/migration/importFromHTMLFile.ts b/lib/api/controllers/migration/importFromHTMLFile.ts
index 21fb3c48..745ee053 100644
--- a/lib/api/controllers/migration/importFromHTMLFile.ts
+++ b/lib/api/controllers/migration/importFromHTMLFile.ts
@@ -63,11 +63,21 @@ async function processBookmarks(
) as Element;
if (collectionName) {
- collectionId = await createCollection(
- userId,
- (collectionName.children[0] as TextNode).content,
- parentCollectionId
- );
+ const collectionNameContent = (collectionName.children[0] as TextNode)?.content;
+ if (collectionNameContent) {
+ collectionId = await createCollection(
+ userId,
+ collectionNameContent,
+ parentCollectionId
+ );
+ } else {
+ // Handle the case when the collection name is empty
+ collectionId = await createCollection(
+ userId,
+ "Untitled Collection",
+ parentCollectionId
+ );
+ }
}
await processBookmarks(
userId,
@@ -264,3 +274,4 @@ function processNodes(nodes: Node[]) {
nodes.forEach(findAndProcessDL);
return nodes;
}
+