From f36bf69624b4174a2248f0ec99a405551c7e7ce3 Mon Sep 17 00:00:00 2001 From: OxSaitama Date: Fri, 6 Oct 2023 11:06:18 +0200 Subject: [PATCH] fix accepted files for customer --- src/app/api/customer/FilesController.ts | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/app/api/customer/FilesController.ts b/src/app/api/customer/FilesController.ts index 925b30c7..67fea6e2 100644 --- a/src/app/api/customer/FilesController.ts +++ b/src/app/api/customer/FilesController.ts @@ -88,6 +88,10 @@ export default class FilesController extends ApiController { try { //get file if (!req.file) throw new Error("No file provided"); + if (req.file.mimetype !== "application/pdf" && req.file.mimetype !== "image/png" && req.file.mimetype !== "image/jpeg") { + this.httpBadRequest(response, "File type not supported"); + return; + } //init File resource with request body values const fileEntity = File.hydrate(JSON.parse(req.body["q"]));