Skip to content

Build your personal knowledge base with Trilium Notes

be loosy and honor startsWith application/javascript

Wael Nasreddine3d1f6c4f91b2
diff --git a/apps/server/src/services/export/zip/share_theme.ts b/apps/server/src/services/export/zip/share_theme.ts
index 7775b52d6d..2f1784c132 100644
--- a/apps/server/src/services/export/zip/share_theme.ts
+++ b/apps/server/src/services/export/zip/share_theme.ts
@@ -116,8 +116,7 @@ export default class ShareThemeExportProvider extends ZipExportProvider {
return null;
}
- // TODO: Should we allow mime to also include backend, i.e loosely check that it starts with application/javascript and ignore the rest?
- if (type === "code" && mime === "application/javascript;env=frontend"){
+ if (mime.startsWith("application/javascript")) {
return "js";
}
diff --git a/apps/server/src/share/content_renderer.ts b/apps/server/src/share/content_renderer.ts
index 1316af4ceb..7a92d2728b 100644
--- a/apps/server/src/share/content_renderer.ts
+++ b/apps/server/src/share/content_renderer.ts
@@ -155,7 +155,7 @@ interface RenderArgs {
}
function renderNoteContentInternal(note: SNote | BNote, renderArgs: RenderArgs) {
- if (renderArgs.isStatic && note.type == "code" && note.mime === "application/javascript;env=frontend") {
+ 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`);