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
fix(server): align attachment upload validation with note upload
Elian Doran8ff41d8fa924
diff --git a/apps/server/src/routes/api/files.ts b/apps/server/src/routes/api/files.tsindex 4a6e17382b..078feed170 100644--- a/apps/server/src/routes/api/files.ts+++ b/apps/server/src/routes/api/files.ts@@ -232,6 +232,10 @@ function uploadModifiedFileToAttachment(req: Request) {const { attachmentId } = req.params;const { filePath } = req.body;+ if (!createdTemporaryFiles.has(filePath)) {+ throw new ValidationError(`File '${filePath}' is not a temporary file.`);+ }+const attachment = becca.getAttachmentOrThrow(attachmentId);log.info(`Updating attachment '${attachmentId}' with content from '${filePath}'`);