From 8ff41d8fa924686f039f8ab7bcf3b2cc5deb5b8e Mon Sep 17 00:00:00 2001 From: Elian Doran Date: Sat, 4 Apr 2026 20:46:03 +0300 Subject: [PATCH] fix(server): align attachment upload validation with note upload --- apps/server/src/routes/api/files.ts | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/apps/server/src/routes/api/files.ts b/apps/server/src/routes/api/files.ts index 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}'`);