Skip to content

Build your personal knowledge base with Trilium Notes

fix(export/share): assets incorrectly rewritten

Elian Doranba26c478d6aa
diff --git a/apps/server/src/services/export/zip/share_theme.ts b/apps/server/src/services/export/zip/share_theme.ts
index c33951c034..e33390735e 100644
--- a/apps/server/src/services/export/zip/share_theme.ts
+++ b/apps/server/src/services/export/zip/share_theme.ts
@@ -52,7 +52,10 @@ export default class ShareThemeExportProvider extends ZipExportProvider {
if (note) {
content = renderNoteForExport(note, branch, basePath, noteMeta.notePath.slice(0, -1));
if (typeof content === "string") {
- content = content.replace(/href="[^"]*\.\/([a-zA-Z0-9_\/]{12})[^"]*"/g, "href=\"#root/$1\"");
+ content = content.replace(/href="[^"]*\.\/([a-zA-Z0-9_\/]{12})[^"]*"/g, (match, id) => {
+ if (match.includes("/assets/")) return match;
+ return `href="#root/${id}"`;
+ });
content = this.rewriteFn(content, noteMeta);
}
}