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()