Skip to content

Build your personal knowledge base with Trilium Notes

fix(share): some reference links appear with [missing note]

Elian Doran1e86d8503516
diff --git a/apps/server/src/share/content_renderer.ts b/apps/server/src/share/content_renderer.ts
index ec3893ee5b..86ee0abc81 100644
--- a/apps/server/src/share/content_renderer.ts
+++ b/apps/server/src/share/content_renderer.ts
@@ -318,13 +318,13 @@ function renderText(result: Result, note: SNote | BNote) {
continue;
}
- if (href?.startsWith("#")) {
- handleAttachmentLink(linkEl, href, getNote, getAttachment);
- }
-
if (linkEl.classList.contains("reference-link")) {
cleanUpReferenceLinks(linkEl);
}
+
+ if (href?.startsWith("#")) {
+ handleAttachmentLink(linkEl, href, getNote, getAttachment);
+ }
}
// Apply syntax highlight.
@@ -400,6 +400,7 @@ function cleanUpReferenceLinks(linkEl: HTMLElement) {
const noteId = href.split("/").at(-1);
const note = noteId ? shaca.getNote(noteId) : undefined;
if (!note) {
+ console.warn("Unable to find note ", noteId);
linkEl.innerHTML = "[missing note]";
} else if (note.isProtected) {
linkEl.innerHTML = "[protected]";