Build your personal knowledge base with Trilium Notes
TypeScript electronelectron-appknowledge-baseknowledge-graphknowledge-managementknowledge-management-graphlocal-firstnote-managmentnote-takernote-takingnotebooknotesnotes-apppersonal-knowledge-basepersonal-wikiscriptableself-hostedself-hostingwiki
Update apps/server/src/etapi/notes.ts
Elian Doran465c36407cb3
diff --git a/apps/server/src/etapi/notes.ts b/apps/server/src/etapi/notes.tsindex 544efd9dc6..f7fb5c9c64 100644--- a/apps/server/src/etapi/notes.ts+++ b/apps/server/src/etapi/notes.ts@@ -99,9 +99,10 @@ function register(router: Router) {}// Validate MIME type for image notes (check both current and new type/mime)- const effectiveType = req.body.type || note.type;- const effectiveMime = req.body.mime || note.mime;- if (effectiveType === "image" && effectiveMime && !effectiveMime.startsWith("image/")) {+ const effectiveType = req.body.type ?? note.type;+ const effectiveMime = req.body.mime ?? note.mime;+ const normalizedEffectiveMime = typeof effectiveMime === "string" ? effectiveMime.toLowerCase() : effectiveMime;+ if (effectiveType === "image" && normalizedEffectiveMime && !normalizedEffectiveMime.startsWith("image/")) {throw new eu.EtapiError(400, "INVALID_MIME_FOR_IMAGE", `MIME type '${effectiveMime}' is not allowed for image notes. MIME must start with 'image/'.`);}