fix exporting root note, closes #1024

This commit is contained in:
zadam 2020-05-17 21:07:54 +02:00
parent 108afe8896
commit fa5d982a55
2 changed files with 17 additions and 2 deletions

View file

@ -162,6 +162,13 @@ function getNoteIdFromNotePath(notePath) {
}
function getNoteIdAndParentIdFromNotePath(notePath) {
if (notePath === 'root') {
return {
noteId: 'root',
parentNoteId: 'none'
};
}
let parentNoteId = 'root';
let noteId = '';

View file

@ -11,6 +11,14 @@ async function exportBranch(req, res) {
const {branchId, type, format, version, taskId} = req.params;
const branch = await repository.getBranch(branchId);
if (!branch) {
const message = `Cannot export branch ${branchId} since it does not exist.`;
log.error(message);
res.status(500).send(message);
return;
}
const taskContext = new TaskContext(taskId, 'export');
try {