Skip to content

Build your personal knowledge base with Trilium Notes

improve the protected note handling

Wael Nasreddine7e7f3ba78f91
diff --git a/apps/server/src/share/content_renderer.ts b/apps/server/src/share/content_renderer.ts
index b217560a3f..cb2a9aaa6c 100644
--- a/apps/server/src/share/content_renderer.ts
+++ b/apps/server/src/share/content_renderer.ts
@@ -149,11 +149,11 @@ interface RenderArgs {
}
function renderNoteContentInternal(note: SNote | BNote, renderArgs: RenderArgs) {
+ // When rendering static share, non-protected JavaScript notes should be rendered as-is.
if (renderArgs.isStatic && note.mime.startsWith("application/javascript")) {
if (note.isProtected) {
- // TODO: how to handle this case here?
- throw new Error(`note ${note.noteId} is protected and cannot be exported`);
- }
+ return `console.log("Protected note cannot be exported.");`
+ };
return note.getContent();
}