fixed backup and anonymization with better-sqlite3

This commit is contained in:
zadam
2020-06-20 23:09:34 +02:00
parent 027afab6b1
commit 969f31dde2
8 changed files with 53 additions and 70 deletions

View File

@@ -14,6 +14,7 @@ const commonmark = require('commonmark');
const TaskContext = require('../task_context.js');
const protectedSessionService = require('../protected_session');
const mimeService = require("./mime");
const sql = require("../sql");
const treeService = require("../tree");
/**
@@ -166,19 +167,21 @@ function importTar(taskContext, fileBuffer, importRootNote) {
return;
}
({note} = noteService.createNewNote({
parentNoteId: parentNoteId,
title: noteTitle,
content: '',
noteId: noteId,
type: noteMeta ? noteMeta.type : 'text',
mime: noteMeta ? noteMeta.mime : 'text/html',
prefix: noteMeta ? noteMeta.prefix : '',
isExpanded: noteMeta ? noteMeta.isExpanded : false,
isProtected: importRootNote.isProtected && protectedSessionService.isProtectedSessionAvailable(),
}));
sql.transactional(() => {
({note} = noteService.createNewNote({
parentNoteId: parentNoteId,
title: noteTitle,
content: '',
noteId: noteId,
type: noteMeta ? noteMeta.type : 'text',
mime: noteMeta ? noteMeta.mime : 'text/html',
prefix: noteMeta ? noteMeta.prefix : '',
isExpanded: noteMeta ? noteMeta.isExpanded : false,
isProtected: importRootNote.isProtected && protectedSessionService.isProtectedSessionAvailable(),
}));
saveAttributes(note, noteMeta);
saveAttributes(note, noteMeta);
});
if (!firstNote) {
firstNote = note;