fix(export/share): assets incorrectly rewritten
Some checks are pending
Checks / main (push) Waiting to run

This commit is contained in:
Elian Doran 2025-10-26 12:15:35 +02:00
parent 055fcb7b2a
commit ba26c478d6
No known key found for this signature in database

View File

@ -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);
}
}