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

This commit is contained in:
Elian Doran 2025-11-20 14:39:36 +02:00
parent abfc2fea3e
commit 1e86d85035
No known key found for this signature in database

View File

@ -318,13 +318,13 @@ function renderText(result: Result, note: SNote | BNote) {
continue; continue;
} }
if (href?.startsWith("#")) {
handleAttachmentLink(linkEl, href, getNote, getAttachment);
}
if (linkEl.classList.contains("reference-link")) { if (linkEl.classList.contains("reference-link")) {
cleanUpReferenceLinks(linkEl); cleanUpReferenceLinks(linkEl);
} }
if (href?.startsWith("#")) {
handleAttachmentLink(linkEl, href, getNote, getAttachment);
}
} }
// Apply syntax highlight. // Apply syntax highlight.
@ -400,6 +400,7 @@ function cleanUpReferenceLinks(linkEl: HTMLElement) {
const noteId = href.split("/").at(-1); const noteId = href.split("/").at(-1);
const note = noteId ? shaca.getNote(noteId) : undefined; const note = noteId ? shaca.getNote(noteId) : undefined;
if (!note) { if (!note) {
console.warn("Unable to find note ", noteId);
linkEl.innerHTML = "[missing note]"; linkEl.innerHTML = "[missing note]";
} else if (note.isProtected) { } else if (note.isProtected) {
linkEl.innerHTML = "[protected]"; linkEl.innerHTML = "[protected]";