mirror of
https://github.com/zadam/trilium.git
synced 2025-11-10 23:35:50 +01:00
Merge remote-tracking branch 'origin/develop' into feature/server_esm
This commit is contained in:
@@ -41,22 +41,20 @@ function returnImageInt(image: BNote | BRevision | null, res: Response) {
|
||||
}
|
||||
|
||||
function renderSvgAttachment(image: BNote | BRevision, res: Response, attachmentName: string) {
|
||||
let svgString = '<svg/>'
|
||||
let svg: string | Buffer = '<svg/>'
|
||||
const attachment = image.getAttachmentByTitle(attachmentName);
|
||||
|
||||
const content = attachment.getContent();
|
||||
if (attachment && typeof content === "string") {
|
||||
svgString = content;
|
||||
if (attachment) {
|
||||
svg = attachment.getContent();
|
||||
} else {
|
||||
// backwards compatibility, before attachments, the SVG was stored in the main note content as a separate key
|
||||
const contentSvg = image.getJsonContentSafely()?.svg;
|
||||
|
||||
if (contentSvg) {
|
||||
svgString = contentSvg;
|
||||
svg = contentSvg;
|
||||
}
|
||||
}
|
||||
|
||||
const svg = svgString
|
||||
res.set('Content-Type', "image/svg+xml");
|
||||
res.set("Cache-Control", "no-cache, no-store, must-revalidate");
|
||||
res.send(svg);
|
||||
|
||||
@@ -5,7 +5,6 @@ import { JSDOM } from "jsdom";
|
||||
import BNote from "../../becca/entities/bnote.js";
|
||||
import BAttribute from "../../becca/entities/battribute.js";
|
||||
import { Request } from 'express';
|
||||
import ValidationError from "../../errors/validation_error.js";
|
||||
|
||||
function buildDescendantCountMap(noteIdsToCount: string[]) {
|
||||
if (!Array.isArray(noteIdsToCount)) {
|
||||
|
||||
Reference in New Issue
Block a user