downloading note revisions

This commit is contained in:
zadam
2019-11-09 08:53:13 +01:00
parent 58a857cf79
commit 5aa5ec3af1
7 changed files with 80 additions and 12 deletions

View File

@@ -45,10 +45,9 @@ async function downloadNoteFile(noteId, res) {
return res.status(401).send("Protected session not available");
}
const originalFileName = await note.getLabel('originalFileName');
const fileName = originalFileName ? originalFileName.value : note.title;
res.setHeader('Content-Disposition', utils.getContentDisposition(fileName));
// (one) reason we're not using the originFileName (available as label) is that it's not
// available for older note revisions and thus would be inconsistent
res.setHeader('Content-Disposition', utils.getContentDisposition(note.title || "untitled"));
res.setHeader('Content-Type', note.mime);
res.send(await note.getContent());