From c8e36942fc8e31ea02f7d44695c6f84471fec0b5 Mon Sep 17 00:00:00 2001 From: Panagiotis Papadopoulos Date: Thu, 6 Mar 2025 22:59:31 +0100 Subject: [PATCH] chore(lint): get rid of "any" in attachments req.file is of type "Express.Multer.File | undefined". Returning with an "uploaded: false" type object -> same handling as in image.ts --- src/routes/api/attachments.ts | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/routes/api/attachments.ts b/src/routes/api/attachments.ts index b0b46db1f..718c99914 100644 --- a/src/routes/api/attachments.ts +++ b/src/routes/api/attachments.ts @@ -43,7 +43,14 @@ function saveAttachment(req: Request) { function uploadAttachment(req: Request) { const { noteId } = req.params; - const { file } = req as any; + const { file } = req; + + if (!file) { + return { + uploaded: false, + message: `Missing attachment data.` + }; + } const note = becca.getNoteOrThrow(noteId); let url;