Skip to content

Build your personal knowledge base with Trilium Notes

fix(tests): resolve issue with failing image test

perfectra1na92561fef360
diff --git a/apps/server/src/routes/api/image.ts b/apps/server/src/routes/api/image.ts
index 746bad288f..1505f1c505 100644
--- a/apps/server/src/routes/api/image.ts
+++ b/apps/server/src/routes/api/image.ts
@@ -6,6 +6,7 @@ import type BNote from "../../becca/entities/bnote.js";
import type BRevision from "../../becca/entities/brevision.js";
import imageService from "../../services/image.js";
import { RESOURCE_DIR } from "../../services/resource_dir.js";
+import { setSvgHeaders } from "../../services/svg_sanitizer.js";
import { sanitizeSvg } from "../../services/utils.js";
function returnImageFromNote(req: Request<{ noteId: string }>, res: Response) {
@@ -143,6 +144,6 @@ export default {
function sendSanitizedSvg(res: Response, content: string | Buffer) {
const svgString = typeof content === "string" ? content : content.toString("utf-8");
- res.set("Content-Security-Policy", "script-src 'none'");
+ setSvgHeaders(res);
res.send(sanitizeSvg(svgString));
}