Skip to content

Build your personal knowledge base with Trilium Notes

feat(export/share): always render empty files

Elian Doran35622a212253
diff --git a/apps/server/src/services/export/zip.ts b/apps/server/src/services/export/zip.ts
index 2f550898a1..9c0f099d14 100644
--- a/apps/server/src/services/export/zip.ts
+++ b/apps/server/src/services/export/zip.ts
@@ -198,10 +198,13 @@ async function exportToZip(taskContext: TaskContext, branch: BBranch, format: "h
note.sortChildren();
const childBranches = note.getChildBranches().filter((branch) => branch?.noteId !== "_hidden");
- const available = !note.isProtected || protectedSessionService.isProtectedSessionAvailable();
+ let shouldIncludeFile = (!note.isProtected || protectedSessionService.isProtectedSessionAvailable());
+ if (format !== "share") {
+ shouldIncludeFile = shouldIncludeFile && (note.getContent().length > 0 || childBranches.length === 0);
+ }
// if it's a leaf, then we'll export it even if it's empty
- if (available && (note.getContent().length > 0 || childBranches.length === 0)) {
+ if (shouldIncludeFile) {
meta.dataFileName = getDataFileName(note.type, note.mime, baseFileName, existingFileNames);
}