]]>20201223T164236Zlaurent22777@gmail.comevernote.win32
diff --git a/packages/app-cli/tests/enex_to_md/table_with_invalid_content.html b/packages/app-cli/tests/enex_to_md/table_with_invalid_content.html
new file mode 100644
index 0000000000..f74f7fb2c9
--- /dev/null
+++ b/packages/app-cli/tests/enex_to_md/table_with_invalid_content.html
@@ -0,0 +1,11 @@
+
+
+
one
+
two
+
+
+
+
three
+
four
+
+
\ No newline at end of file
diff --git a/packages/app-cli/tests/enex_to_md/table_with_invalid_content.md b/packages/app-cli/tests/enex_to_md/table_with_invalid_content.md
new file mode 100644
index 0000000000..953d1f3a89
--- /dev/null
+++ b/packages/app-cli/tests/enex_to_md/table_with_invalid_content.md
@@ -0,0 +1,4 @@
+| | |
+| --- | --- |
+| one | two |
+| three | four |
\ No newline at end of file
diff --git a/packages/lib/import-enex-md-gen.ts b/packages/lib/import-enex-md-gen.ts
index a8a459a5d0..5440e568e6 100644
--- a/packages/lib/import-enex-md-gen.ts
+++ b/packages/lib/import-enex-md-gen.ts
@@ -1246,6 +1246,14 @@ function drawTable(table: Section) {
for (let tdIndex = 0; tdIndex < tr.lines.length; tdIndex++) {
const td = tr.lines[tdIndex];
+ if (typeof td === 'string') {
+ // A
tag should only have
tags as direct children.
+ // However certain Evernote notes can contain other random tags
+ // such as empty DIVs. In that case we just skip the content.
+ // See test "table_with_invalid_content.html".
+ continue;
+ }
+
if (flatRender) {
line.push(BLOCK_OPEN);
From 495f08832057afb744384db14f9c914bbcefc243 Mon Sep 17 00:00:00 2001
From: Laurent Cozic
Date: Sun, 17 Dec 2023 12:00:05 +0000
Subject: [PATCH 3/4] Desktop, Cli: Remove unnecessary warning when importing
ENEX file
---
packages/lib/import-enex.ts | 31 +++++++++++++++++++------------
1 file changed, 19 insertions(+), 12 deletions(-)
diff --git a/packages/lib/import-enex.ts b/packages/lib/import-enex.ts
index d3048890e1..bd04eec792 100644
--- a/packages/lib/import-enex.ts
+++ b/packages/lib/import-enex.ts
@@ -151,18 +151,22 @@ interface ExtractedNote extends NoteEntity {
tags?: string[];
title?: string;
bodyXml?: string;
- // is_todo?: boolean;
}
-// At this point we have the resource has it's been parsed from the XML, but additional
-// processing needs to be done to get the final resource file, its size, MD5, etc.
+// At this point we have the resource as it's been parsed from the XML, but
+// additional processing needs to be done to get the final resource file, its
+// size, MD5, etc.
async function processNoteResource(resource: ExtractedResource) {
- if (!resource.hasData) {
- // Some resources have no data, go figure, so we need a special case for this.
- resource.id = md5(Date.now() + Math.random());
+ const handleNoDataResource = async (resource: ExtractedResource, setId: boolean) => {
+ if (setId) resource.id = md5(Date.now() + Math.random());
resource.size = 0;
resource.dataFilePath = `${Setting.value('tempDir')}/${resource.id}.empty`;
await fs.writeFile(resource.dataFilePath, '');
+ };
+
+ if (!resource.hasData) {
+ // Some resources have no data, go figure, so we need a special case for this.
+ await handleNoDataResource(resource, true);
} else {
if (resource.dataEncoding === 'base64') {
const decodedFilePath = `${resource.dataFilePath}.decoded`;
@@ -176,16 +180,19 @@ async function processNoteResource(resource: ExtractedResource) {
resource.size = stats.size;
if (!resource.id) {
- // If no resource ID is present, the resource ID is actually the MD5 of the data.
- // This ID will match the "hash" attribute of the corresponding tag.
- // resourceId = md5(decodedData);
+ // If no resource ID is present, the resource ID is actually the MD5
+ // of the data. This ID will match the "hash" attribute of the
+ // corresponding tag. resourceId = md5(decodedData);
resource.id = await md5File(resource.dataFilePath);
}
if (!resource.id || !resource.size) {
- const debugTemp = { ...resource };
- debugTemp.data = debugTemp.data ? `${debugTemp.data.substr(0, 32)}...` : debugTemp.data;
- throw new Error(`This resource was not added because it has no ID or no content: ${JSON.stringify(debugTemp)}`);
+ // Don't throw an error because it happens semi-frequently,
+ // especially on notes that comes from the Evernote Web Clipper and
+ // we can't do anything about it. Previously we would throw the
+ // error "This resource was not added because it has no ID or no
+ // content".
+ await handleNoDataResource(resource, !resource.id);
}
}
From 973193623a42ba6f54e1c8fec2b3ce67e7cc76aa Mon Sep 17 00:00:00 2001
From: Laurent Cozic
Date: Fri, 22 Dec 2023 09:30:38 +0000
Subject: [PATCH 4/4] Desktop release v2.13.10
---
packages/app-desktop/package.json | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/packages/app-desktop/package.json b/packages/app-desktop/package.json
index fcd3e016dc..3064f41526 100644
--- a/packages/app-desktop/package.json
+++ b/packages/app-desktop/package.json
@@ -1,6 +1,6 @@
{
"name": "@joplin/app-desktop",
- "version": "2.13.9",
+ "version": "2.13.10",
"description": "Joplin for Desktop",
"main": "main.js",
"private": true,