Build your personal knowledge base with Trilium Notes
TypeScript electronelectron-appknowledge-baseknowledge-graphknowledge-managementknowledge-management-graphlocal-firstnote-managmentnote-takernote-takingnotebooknotesnotes-apppersonal-knowledge-basepersonal-wikiscriptableself-hostedself-hostingwiki
Merge remote-tracking branch 'origin/main' into static-correct-type
Elian Doranf3cfa84d1d1f
diff --cc apps/server/src/services/export/zip/share_theme.tsindex 2f1784c132,ba1703163b..316984d50c--- a/apps/server/src/services/export/zip/share_theme.ts+++ b/apps/server/src/services/export/zip/share_theme.ts@@@ -69,9 -74,18 +74,19 @@@ export default class ShareThemeExportPrwhitespaceCharacters: "\t\r\n\f\u200b\u00a0\u2002"}) : "";- content = renderNoteForExport(note, branch, basePath, noteMeta.notePath.slice(0, -1));+ // TODO: This will probably never match, but should it be exclude from running on code/jsFrontend notes?+ content = renderNoteForExport(note, branch, basePath, noteMeta.notePath.slice(0, -1), this.iconPacks);if (typeof content === "string") {+ // Rewrite attachment download links+ content = content.replace(/href="api\/attachments\/([a-zA-Z0-9_]+)\/download"/g, (match, attachmentId) => {+ const attachmentMeta = (noteMeta.attachments || []).find((attMeta) => attMeta.attachmentId === attachmentId);+ if (attachmentMeta?.dataFileName) {+ return `href="${attachmentMeta.dataFileName}"`;+ }+ return match;+ });++ // Rewrite note linkscontent = content.replace(/href="[^"]*\.\/([a-zA-Z0-9_\/]{12})[^"]*"/g, (match, id) => {if (match.includes("/assets/")) return match;if (id === this.rootMeta?.noteId) {@@@ -116,10 -130,11 +131,15 @@@return null;}+ if (mime.startsWith("application/javascript")) {+ return "js";+ }++ // Don't add .html if the file already has .zip extension (for attachments).+ if (existingExtension === ".zip") {+ return null;+ }+return "html";}