added versioning to the metadata files in export tars

This commit is contained in:
azivner 2018-03-03 09:32:21 -05:00
parent 8c7d159012
commit 83d6c2970f
2 changed files with 5 additions and 0 deletions

View File

@ -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,

View File

@ -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");
}