From 1e53381d8895218861fff82c02920ec45edb29f7 Mon Sep 17 00:00:00 2001 From: Nikhil Shahi Date: Fri, 5 Aug 2022 21:33:43 -0500 Subject: [PATCH] fix update spec handler --- backend/src/api/spec/index.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/backend/src/api/spec/index.ts b/backend/src/api/spec/index.ts index 7bc0cb0b..b0471149 100644 --- a/backend/src/api/spec/index.ts +++ b/backend/src/api/spec/index.ts @@ -59,7 +59,10 @@ export const deleteSpecHandler = async (req: Request, res: Response) => { export const updateSpecHandler = async (req: Request, res: Response) => { try { const specFile = req.file; - const fileName = req.file.filename || req.file.fieldname; + const fileName = specFile.originalname + ?.split(".json")[0] + ?.split(".yaml")[0] + ?.split(".yml")[0]; if (!fileName) { throw new Error400BadRequest("No filename provided."); }