Skip to content

Build your personal knowledge base with Trilium Notes

added versioning to the metadata files in export tars

azivner83d6c2970fb8
diff --git a/src/routes/api/export.js b/src/routes/api/export.js
index 06a850f6b3..6c6c2926a4 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 b64db03b06..dfbed493ee 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");
}