mirror of
https://github.com/TriliumNext/Notes.git
synced 2025-07-29 19:12:27 +08:00
chore(share): fix tsc nagging about svg not existing on unknown
JSON and TS without using a validation library like zod, is really a bit of a pain in the backside...
This commit is contained in:
parent
2a5ac80c05
commit
a5a66a12e2
@ -115,7 +115,14 @@ function renderImageAttachment(image: SNote, res: Response, attachmentName: stri
|
|||||||
svgString = content;
|
svgString = content;
|
||||||
} else {
|
} else {
|
||||||
// backwards compatibility, before attachments, the SVG was stored in the main note content as a separate key
|
// 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) {
|
if (contentSvg) {
|
||||||
svgString = contentSvg;
|
svgString = contentSvg;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user