mirror of
https://github.com/zadam/trilium.git
synced 2025-11-18 11:10:41 +01:00
Merge remote-tracking branch 'origin/stable'
This commit is contained in:
@@ -1,6 +1,5 @@
|
||||
"use strict";
|
||||
|
||||
const noteService = require('../../services/notes');
|
||||
const protectedSessionService = require('../../services/protected_session');
|
||||
const repository = require('../../services/repository');
|
||||
const utils = require('../../services/utils');
|
||||
@@ -45,7 +44,9 @@ async function downloadNoteFile(noteId, res, contentDisposition = true) {
|
||||
if (contentDisposition) {
|
||||
// (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"));
|
||||
const filename = utils.formatDownloadTitle(note.title, note.type, note.mime);
|
||||
|
||||
res.setHeader('Content-Disposition', utils.getContentDisposition(filename));
|
||||
}
|
||||
|
||||
res.setHeader('Content-Type', note.mime);
|
||||
@@ -70,4 +71,4 @@ module.exports = {
|
||||
openFile,
|
||||
downloadFile,
|
||||
downloadNoteFile
|
||||
};
|
||||
};
|
||||
|
||||
@@ -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
|
||||
};
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user