From e70c862e721c5fdab2b4039b3e80f2bb33564f3d Mon Sep 17 00:00:00 2001 From: zadam Date: Sun, 7 Jun 2020 23:55:55 +0200 Subject: [PATCH] fix import --- src/services/backup.js | 6 ++++-- src/services/import/tar.js | 6 +++--- src/services/import/zip.js | 4 ++-- 3 files changed, 9 insertions(+), 7 deletions(-) diff --git a/src/services/backup.js b/src/services/backup.js index c1027a3d2..32ae99754 100644 --- a/src/services/backup.js +++ b/src/services/backup.js @@ -110,8 +110,10 @@ async function anonymize() { await db.run(`UPDATE attributes SET name = 'name' WHERE type = 'relation' AND name NOT IN (${builtinAttrs})`); await db.run("UPDATE branches SET prefix = 'prefix' WHERE prefix IS NOT NULL"); await db.run(`UPDATE options SET value = 'anonymized' WHERE name IN - ('documentId', 'documentSecret', 'encryptedDataKey', 'passwordVerificationHash', - 'passwordVerificationSalt', 'passwordDerivedKeySalt', 'username', 'syncServerHost', 'syncProxy')`); + ('documentId', 'documentSecret', 'encryptedDataKey', + 'passwordVerificationHash', 'passwordVerificationSalt', + 'passwordDerivedKeySalt', 'username', 'syncServerHost', 'syncProxy') + AND value != ''`); await db.run("VACUUM"); await db.close(); diff --git a/src/services/import/tar.js b/src/services/import/tar.js index f09c26d16..68d1c2a68 100644 --- a/src/services/import/tar.js +++ b/src/services/import/tar.js @@ -47,7 +47,7 @@ async function importTar(taskContext, fileBuffer, importRootNote) { return noteIdMap[origNoteId]; } - + function getMeta(filePath) { if (!metaFile) { return {}; @@ -425,7 +425,7 @@ async function importTar(taskContext, fileBuffer, importRootNote) { } for (const noteId in createdNoteIds) { // now the noteIds are unique - await noteService.scanForLinks(await repository.getNotes(noteId)); + await noteService.scanForLinks(await repository.getNote(noteId)); if (!metaFile) { // if there's no meta file then the notes are created based on the order in that tar file but that @@ -459,4 +459,4 @@ async function importTar(taskContext, fileBuffer, importRootNote) { module.exports = { importTar -}; \ No newline at end of file +}; diff --git a/src/services/import/zip.js b/src/services/import/zip.js index cb4929165..a87f7aa2b 100644 --- a/src/services/import/zip.js +++ b/src/services/import/zip.js @@ -454,7 +454,7 @@ async function importZip(taskContext, fileBuffer, importRootNote) { }); for (const noteId in createdNoteIds) { // now the noteIds are unique - await noteService.scanForLinks(await repository.getNotes(noteId)); + await noteService.scanForLinks(await repository.getNote(noteId)); if (!metaFile) { // if there's no meta file then the notes are created based on the order in that tar file but that @@ -481,4 +481,4 @@ async function importZip(taskContext, fileBuffer, importRootNote) { module.exports = { importZip -}; \ No newline at end of file +};