diff --git a/src/routes/api/export.js b/src/routes/api/export.js index 06a850f6b..6c6c2926a 100644 --- a/src/routes/api/export.js +++ b/src/routes/api/export.js @@ -64,6 +64,7 @@ async function exportNote(noteTreeId, directory, pack, repo) { async function getMetadata(note) { return { + version: 1, title: note.title, type: note.type, mime: note.mime, diff --git a/src/routes/api/import.js b/src/routes/api/import.js index b64db03b0..dfbed493e 100644 --- a/src/routes/api/import.js +++ b/src/routes/api/import.js @@ -112,6 +112,10 @@ router.post('/:parentNoteId', auth.checkApiAuthOrElectron, multer.single('upload async function importNotes(files, parentNoteId, sourceId) { for (const file of files) { + if (file.meta.version !== 1) { + throw new Error("Can't read meta data version " + file.meta.version); + } + if (file.meta.type !== 'file') { file.data = file.data.toString("UTF-8"); }