Skip to content
This repository was archived by the owner on Jun 24, 2025. It is now read-only.

Commit 8b79975

Browse files
committed
server: Fix SVG backwards compatibility (fixes #238)
1 parent 824bc47 commit 8b79975

File tree

2 files changed

+2
-3
lines changed

2 files changed

+2
-3
lines changed

src/becca/entities/bnote.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1151,7 +1151,7 @@ class BNote extends AbstractBeccaEntity<BNote> {
11511151
.map(row => new BAttachment(row));
11521152
}
11531153

1154-
getAttachmentByTitle(title: string): BAttachment {
1154+
getAttachmentByTitle(title: string): BAttachment | undefined {
11551155
// cannot use SQL to filter by title since it can be encrypted
11561156
return this.getAttachments().filter(attachment => attachment.title === title)[0];
11571157
}

src/routes/api/image.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,9 +44,8 @@ function renderSvgAttachment(image: BNote | BRevision, res: Response, attachment
4444
let svg: string | Buffer = '<svg/>'
4545
const attachment = image.getAttachmentByTitle(attachmentName);
4646

47-
const content = attachment.getContent();
4847
if (attachment) {
49-
svg = content;
48+
svg = attachment.getContent();
5049
} else {
5150
// backwards compatibility, before attachments, the SVG was stored in the main note content as a separate key
5251
const contentSvg = image.getJsonContentSafely()?.svg;

0 commit comments

Comments
 (0)