From 6c431ae5ed27dfdfc50b41df4f84797d45881e5b Mon Sep 17 00:00:00 2001 From: zadam Date: Thu, 15 Dec 2022 14:14:21 +0100 Subject: [PATCH] fix enex import splitting image/resource into multiple chunks, closes #3424 --- package-lock.json | 5 ++--- src/services/import/enex.js | 7 ++++++- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/package-lock.json b/package-lock.json index 803689d63..36a24c609 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,11 @@ { "name": "trilium", - "version": "0.57.2", + "version": "0.57.5", "lockfileVersion": 2, "requires": true, "packages": { "": { - "name": "trilium", - "version": "0.57.2", + "version": "0.57.5", "hasInstallScript": true, "license": "AGPL-3.0-only", "dependencies": { diff --git a/src/services/import/enex.js b/src/services/import/enex.js index 710283b09..bfe747e4a 100644 --- a/src/services/import/enex.js +++ b/src/services/import/enex.js @@ -148,7 +148,10 @@ function importEnex(taskContext, file, parentNote) { if (currentTag === 'data') { text = text.replace(/\s/g, ''); - resource.content = utils.fromBase64(text); + // resource can be chunked into multiple events: https://github.com/zadam/trilium/issues/3424 + // it would probably make sense to do this in a more global way since it can in theory affect any field, + // not just data + resource.content = (resource.content || "") + text; } else if (currentTag === 'mime') { resource.mime = text.toLowerCase(); @@ -246,6 +249,8 @@ function importEnex(taskContext, file, parentNote) { continue; } + resource.content = utils.fromBase64(resource.content); + const hash = utils.md5(resource.content); // skip all checked/unchecked checkboxes from OneNote