diff --git a/db/demo.tar b/db/demo.tar index 4edf70636..599f8a0b9 100644 Binary files a/db/demo.tar and b/db/demo.tar differ diff --git a/src/services/import/tar.js b/src/services/import/tar.js index 64a70e0b7..899fc5065 100644 --- a/src/services/import/tar.js +++ b/src/services/import/tar.js @@ -115,24 +115,28 @@ async function importTar(importContext, fileBuffer, importRootNote) { function getNoteId(noteMeta, filePath) { let noteId; - if (noteMeta) { - noteId = getNewNoteId(noteMeta.noteId); + const filePathNoExt = getTextFileWithoutExtension(filePath); - createdPaths[filePath] = noteId; + if (noteMeta) { + if (filePathNoExt in createdPaths) { + noteId = createdPaths[filePathNoExt]; + noteIdMap[noteMeta.noteId] = noteId; + } + else { + noteId = getNewNoteId(noteMeta.noteId); + } } else { - const filePathNoExt = getTextFileWithoutExtension(filePath); - if (filePathNoExt in createdPaths) { noteId = createdPaths[filePathNoExt]; } else { noteId = utils.newEntityId(); } - - createdPaths[filePathNoExt] = noteId; } + createdPaths[filePathNoExt] = noteId; + return noteId; }