Build your personal knowledge base with Trilium Notes
TypeScript electronelectron-appknowledge-baseknowledge-graphknowledge-managementknowledge-management-graphlocal-firstnote-managmentnote-takernote-takingnotebooknotesnotes-apppersonal-knowledge-basepersonal-wikiscriptableself-hostedself-hostingwiki
chore(share): fix tsc nagging about svg not existing on unknown
Panagiotis Papadopoulosa5a66a12e2ce
diff --git a/src/share/routes.ts b/src/share/routes.tsindex 932adfaacd..a2dbb6e0dd 100644--- a/src/share/routes.ts+++ b/src/share/routes.ts@@ -115,7 +115,14 @@ function renderImageAttachment(image: SNote, res: Response, attachmentName: strisvgString = content;} else {// backwards compatibility, before attachments, the SVG was stored in the main note content as a separate key- const contentSvg = image.getJsonContentSafely()?.svg;+ const possibleSvgContent = image.getJsonContentSafely();++ const contentSvg = (typeof possibleSvgContent === "object"+ && possibleSvgContent !== null+ && "svg" in possibleSvgContent+ && typeof possibleSvgContent.svg === "string")+ ? possibleSvgContent.svg+ : null;if (contentSvg) {svgString = contentSvg;