mirror of
https://github.com/zadam/trilium.git
synced 2025-03-01 14:22:32 +01:00
server: Fix SVG backwards compatibility (fixes #238)
This commit is contained in:
parent
824bc4705f
commit
8b79975500
@ -1151,7 +1151,7 @@ class BNote extends AbstractBeccaEntity<BNote> {
|
|||||||
.map(row => new BAttachment(row));
|
.map(row => new BAttachment(row));
|
||||||
}
|
}
|
||||||
|
|
||||||
getAttachmentByTitle(title: string): BAttachment {
|
getAttachmentByTitle(title: string): BAttachment | undefined {
|
||||||
// cannot use SQL to filter by title since it can be encrypted
|
// cannot use SQL to filter by title since it can be encrypted
|
||||||
return this.getAttachments().filter(attachment => attachment.title === title)[0];
|
return this.getAttachments().filter(attachment => attachment.title === title)[0];
|
||||||
}
|
}
|
||||||
|
@ -44,9 +44,8 @@ function renderSvgAttachment(image: BNote | BRevision, res: Response, attachment
|
|||||||
let svg: string | Buffer = '<svg/>'
|
let svg: string | Buffer = '<svg/>'
|
||||||
const attachment = image.getAttachmentByTitle(attachmentName);
|
const attachment = image.getAttachmentByTitle(attachmentName);
|
||||||
|
|
||||||
const content = attachment.getContent();
|
|
||||||
if (attachment) {
|
if (attachment) {
|
||||||
svg = content;
|
svg = attachment.getContent();
|
||||||
} 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 contentSvg = image.getJsonContentSafely()?.svg;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user