From 4fff4c0c88ce1baaea68ead8562abad88bdcdcfe Mon Sep 17 00:00:00 2001 From: Marcel Klehr Date: Sat, 9 Dec 2023 16:06:16 +0100 Subject: [PATCH] fix(XbelSerializer): titles need their own element fixes #1450 Signed-off-by: Marcel Klehr <mklehr@gmx.net> --- src/lib/serializers/Xbel.ts | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/src/lib/serializers/Xbel.ts b/src/lib/serializers/Xbel.ts index bc3fea29cb..8cfbe83acc 100644 --- a/src/lib/serializers/Xbel.ts +++ b/src/lib/serializers/Xbel.ts @@ -41,13 +41,13 @@ class XbelSerializer implements Serializer { id: parseInt(node[':@']['@_id']), parentId: folder.id, url: node[':@']['@_href'], - title: node.bookmark?.[0]?.['#text'] || '', + title: node.bookmark?.[0]?.title?.[0]?.['#text'] || '', location: ItemLocation.SERVER, }) } else if (typeof node.folder !== 'undefined') { item = new Folder({ id: parseInt(node[':@']?.['@_id']), - title: node[':@']?.['@_title'] || '', + title: node.folder?.[0]?.title?.[0]?.['#text'] || '', parentId: folder.id, location: ItemLocation.SERVER, }) @@ -66,7 +66,7 @@ class XbelSerializer implements Serializer { if (child instanceof Bookmark) { return { bookmark: [ - {'#text': child.title} + {title: [{'#text': child.title}]} ], ':@': { '@_href': child.url, @@ -77,10 +77,12 @@ class XbelSerializer implements Serializer { if (child instanceof Folder) { return { - folder: this._serializeFolder(child), + folder: [ + {title: [{'#text': child.title}]}, + ...this._serializeFolder(child) + ], ':@': { ...('id' in child && {'@_id': String(child.id)}), - '@_title': child.title, } } }