Skip to content

Commit c54befa

Browse files
committed
fix(export/share): header link not working
1 parent 87c0559 commit c54befa

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

apps/server/src/services/export/zip/share_theme.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ export default class ShareThemeExportProvider extends ZipExportProvider {
2727
private assetsMeta: NoteMeta[] = [];
2828
private indexMeta: NoteMeta | null = null;
2929
private searchIndex: Map<string, SearchIndexEntry> = new Map();
30+
private rootMeta: NoteMeta | null = null;
3031

3132
prepareMeta(metaFile: NoteMetaFile): void {
3233
const assets = [
@@ -50,6 +51,7 @@ export default class ShareThemeExportProvider extends ZipExportProvider {
5051
noImport: true,
5152
dataFileName: "index.html"
5253
};
54+
this.rootMeta = metaFile.files[0];
5355

5456
metaFile.files.push(this.indexMeta);
5557
}
@@ -71,6 +73,9 @@ export default class ShareThemeExportProvider extends ZipExportProvider {
7173
if (typeof content === "string") {
7274
content = content.replace(/href="[^"]*\.\/([a-zA-Z0-9_\/]{12})[^"]*"/g, (match, id) => {
7375
if (match.includes("/assets/")) return match;
76+
if (id === this.rootMeta?.noteId) {
77+
return `href="${basePath}"`;
78+
}
7479
return `href="#root/${id}"`;
7580
});
7681
content = this.rewriteFn(content, noteMeta);

0 commit comments

Comments
 (0)