mirror of
https://github.com/zadam/trilium.git
synced 2025-03-01 14:22:32 +01:00
use [protected] for protected notes in the export
This commit is contained in:
parent
b90ba3d1a9
commit
d4d48f3834
@ -71,14 +71,7 @@ function getNoteTitle(childNoteId, parentNoteId) {
|
|||||||
return "[error fetching title]";
|
return "[error fetching title]";
|
||||||
}
|
}
|
||||||
|
|
||||||
let title;
|
const title = childNote.getTitleOrProtected();
|
||||||
|
|
||||||
if (childNote.isProtected) {
|
|
||||||
title = protectedSessionService.isProtectedSessionAvailable() ? childNote.title : '[protected]';
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
title = childNote.title;
|
|
||||||
}
|
|
||||||
|
|
||||||
const branch = parentNote ? becca.getBranchFromChildAndParent(childNote.noteId, parentNote.noteId) : null;
|
const branch = parentNote ? becca.getBranchFromChildAndParent(childNote.noteId, parentNote.noteId) : null;
|
||||||
|
|
||||||
|
@ -131,6 +131,10 @@ class Note extends AbstractEntity {
|
|||||||
|| protectedSessionService.isProtectedSessionAvailable()
|
|| protectedSessionService.isProtectedSessionAvailable()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
getTitleOrProtected() {
|
||||||
|
return this.isContentAvailable() ? this.title : '[protected]';
|
||||||
|
}
|
||||||
|
|
||||||
/** @returns {Branch[]} */
|
/** @returns {Branch[]} */
|
||||||
getParentBranches() {
|
getParentBranches() {
|
||||||
return this.parentBranches;
|
return this.parentBranches;
|
||||||
|
@ -98,7 +98,7 @@ function getLinkMap(req) {
|
|||||||
|
|
||||||
return [
|
return [
|
||||||
note.noteId,
|
note.noteId,
|
||||||
note.isContentAvailable() ? note.title : '[protected]',
|
note.getTitleOrProtected(),
|
||||||
note.type
|
note.type
|
||||||
];
|
];
|
||||||
});
|
});
|
||||||
@ -158,7 +158,7 @@ function getTreeMap(req) {
|
|||||||
.concat(...mapRootNote.getParentNotes())
|
.concat(...mapRootNote.getParentNotes())
|
||||||
.map(note => [
|
.map(note => [
|
||||||
note.noteId,
|
note.noteId,
|
||||||
note.isContentAvailable() ? note.title : '[protected]',
|
note.getTitleOrProtected(),
|
||||||
note.type
|
note.type
|
||||||
]);
|
]);
|
||||||
|
|
||||||
|
@ -54,7 +54,7 @@ function getNotesAndBranchesAndAttributes(noteIds) {
|
|||||||
|
|
||||||
notes.push({
|
notes.push({
|
||||||
noteId: note.noteId,
|
noteId: note.noteId,
|
||||||
title: note.isDecrypted ? note.title : '[protected]',
|
title: note.getTitleOrProtected(),
|
||||||
isProtected: note.isProtected,
|
isProtected: note.isProtected,
|
||||||
type: note.type,
|
type: note.type,
|
||||||
mime: note.mime
|
mime: note.mime
|
||||||
|
@ -97,7 +97,8 @@ function exportToZip(taskContext, branch, format, res) {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
const completeTitle = branch.prefix ? (branch.prefix + ' - ' + note.title) : note.title;
|
const title = note.getTitleOrProtected();
|
||||||
|
const completeTitle = branch.prefix ? (branch.prefix + ' - ' + title) : title;
|
||||||
let baseFileName = sanitize(completeTitle);
|
let baseFileName = sanitize(completeTitle);
|
||||||
|
|
||||||
if (baseFileName.length > 200) { // actual limit is 256 bytes(!) but let's be conservative
|
if (baseFileName.length > 200) { // actual limit is 256 bytes(!) but let's be conservative
|
||||||
@ -113,7 +114,7 @@ function exportToZip(taskContext, branch, format, res) {
|
|||||||
isClone: true,
|
isClone: true,
|
||||||
noteId: note.noteId,
|
noteId: note.noteId,
|
||||||
notePath: notePath,
|
notePath: notePath,
|
||||||
title: note.title,
|
title: note.getTitleOrProtected(),
|
||||||
prefix: branch.prefix,
|
prefix: branch.prefix,
|
||||||
dataFileName: fileName,
|
dataFileName: fileName,
|
||||||
type: 'text', // export will have text description,
|
type: 'text', // export will have text description,
|
||||||
@ -125,7 +126,7 @@ function exportToZip(taskContext, branch, format, res) {
|
|||||||
isClone: false,
|
isClone: false,
|
||||||
noteId: note.noteId,
|
noteId: note.noteId,
|
||||||
notePath: notePath,
|
notePath: notePath,
|
||||||
title: note.title,
|
title: note.getTitleOrProtected(),
|
||||||
notePosition: branch.notePosition,
|
notePosition: branch.notePosition,
|
||||||
prefix: branch.prefix,
|
prefix: branch.prefix,
|
||||||
isExpanded: branch.isExpanded,
|
isExpanded: branch.isExpanded,
|
||||||
@ -445,7 +446,7 @@ ${content}
|
|||||||
}
|
}
|
||||||
|
|
||||||
const note = branch.getNote();
|
const note = branch.getNote();
|
||||||
const zipFileName = (branch.prefix ? `${branch.prefix} - ` : "") + note.title + ".zip";
|
const zipFileName = (branch.prefix ? `${branch.prefix} - ` : "") + note.getTitleOrProtected() + ".zip";
|
||||||
|
|
||||||
res.setHeader('Content-Disposition', utils.getContentDisposition(zipFileName));
|
res.setHeader('Content-Disposition', utils.getContentDisposition(zipFileName));
|
||||||
res.setHeader('Content-Type', 'application/zip');
|
res.setHeader('Content-Type', 'application/zip');
|
||||||
|
Loading…
x
Reference in New Issue
Block a user