From bdd86e35b2ba882ac811276e6635e0b52bc3251a Mon Sep 17 00:00:00 2001 From: mohiit1502 Date: Wed, 17 Dec 2025 20:14:41 +0530 Subject: [PATCH] Fixed multer file parsing bug --- package.json | 2 +- v2/middlewares/utils/multer.ts | 9 ++++++++- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index 94536d4..a2bee71 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@armco/node-starter-kit", - "version": "2.0.3", + "version": "2.0.4", "description": "Modern plugin-based starter kit for Node.js applications with TypeScript, security, and observability", "main": "dist/index.js", "types": "dist/index.d.ts", diff --git a/v2/middlewares/utils/multer.ts b/v2/middlewares/utils/multer.ts index 64964d9..8f89fa3 100644 --- a/v2/middlewares/utils/multer.ts +++ b/v2/middlewares/utils/multer.ts @@ -52,7 +52,14 @@ export async function initMulter(app: Application, config: MulterConfig, logger? const qualifyingRoutes = ar.routes.map((r) => (typeof r === 'string' ? r : r.route)) const handler = (req: Request, res: Response, next: NextFunction) => { - const routeConfig = ar.routes.find((rc) => req.baseUrl === (typeof rc === 'string' ? rc : rc.route)) + // Build full path for matching (baseUrl + path) + const fullPath = (req.baseUrl || '') + (req.path || req.url || '') + + // Find route config that matches the request path + const routeConfig = ar.routes.find((rc) => { + const configRoute = typeof rc === 'string' ? rc : rc.route + return fullPath.startsWith(configRoute) + }) if (!routeConfig) { return next()