mirror of
https://github.com/zadam/trilium.git
synced 2025-11-11 15:55:52 +01:00
always use template strings instead of string concatenation
This commit is contained in:
@@ -13,7 +13,7 @@ function exportSingleNote(taskContext, branch, format, res) {
|
||||
}
|
||||
|
||||
if (format !== 'html' && format !== 'markdown') {
|
||||
return [400, 'Unrecognized format ' + format];
|
||||
return [400, `Unrecognized format ${format}`];
|
||||
}
|
||||
|
||||
let payload, extension, mime;
|
||||
@@ -23,7 +23,7 @@ function exportSingleNote(taskContext, branch, format, res) {
|
||||
if (note.type === 'text') {
|
||||
if (format === 'html') {
|
||||
if (!content.toLowerCase().includes("<html")) {
|
||||
content = '<html><head><meta charset="utf-8"></head><body>' + content + '</body></html>';
|
||||
content = `<html><head><meta charset="utf-8"></head><body>${content}</body></html>`;
|
||||
}
|
||||
|
||||
payload = html.prettyPrint(content, {indent_size: 2});
|
||||
@@ -47,10 +47,10 @@ function exportSingleNote(taskContext, branch, format, res) {
|
||||
mime = 'application/json';
|
||||
}
|
||||
|
||||
const filename = note.title + "." + extension;
|
||||
const filename = `${note.title}.${extension}`;
|
||||
|
||||
res.setHeader('Content-Disposition', utils.getContentDisposition(filename));
|
||||
res.setHeader('Content-Type', mime + '; charset=UTF-8');
|
||||
res.setHeader('Content-Type', `${mime}; charset=UTF-8`);
|
||||
|
||||
res.send(payload);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user