diff --git a/apps/web/lib/importBookmarkParser.ts b/apps/web/lib/importBookmarkParser.ts index e1b21a79..1f80e5f4 100644 --- a/apps/web/lib/importBookmarkParser.ts +++ b/apps/web/lib/importBookmarkParser.ts @@ -24,15 +24,17 @@ export async function parseNetscapeBookmarkFile( const $a = $(a); const addDate = $a.attr("add_date"); let tags: string[] = []; + + const tagsStr = $a.attr("tags"); try { - tags = $a.attr("tags")?.split(",") ?? []; + tags = tagsStr && tagsStr.length > 0 ? tagsStr.split(",") : []; } catch (e) { /* empty */ } return { title: $a.text(), url: $a.attr("href"), - tags: tags, + tags, addDate: typeof addDate === "undefined" ? undefined : parseInt(addDate), }; }) @@ -60,7 +62,7 @@ export async function parsePocketBookmarkFile( return { title: $a.text(), url: $a.attr("href"), - tags: tags, + tags, addDate: typeof addDate === "undefined" ? undefined : parseInt(addDate), }; })