attach extension to download file if note present

This commit is contained in:
zadam
2020-05-12 10:28:31 +02:00
parent cb70109ee7
commit 9d8b8e26a1
4 changed files with 53 additions and 18 deletions

View File

@@ -38,13 +38,7 @@ async function getNoteRevision(req) {
* @return {string}
*/
function getRevisionFilename(noteRevision) {
let filename = noteRevision.title || "untitled";
if (noteRevision.type === 'text') {
filename += '.html';
} else if (['relation-map', 'search'].includes(noteRevision.type)) {
filename += '.json';
}
let filename = utils.formatDownloadTitle(noteRevision.title, noteRevision.type, noteRevision.mime);
const extension = path.extname(filename);
const date = noteRevision.dateCreated
@@ -158,4 +152,4 @@ module.exports = {
eraseAllNoteRevisions,
eraseNoteRevision,
restoreNoteRevision
};
};