diff --git a/frontend/src/component/project/Project/Import/validate/ValidationStage.tsx b/frontend/src/component/project/Project/Import/validate/ValidationStage.tsx index ad0ab59eb5..3246e04bff 100644 --- a/frontend/src/component/project/Project/Import/validate/ValidationStage.tsx +++ b/frontend/src/component/project/Project/Import/validate/ValidationStage.tsx @@ -159,12 +159,16 @@ export const ValidationStage: FC<{ the import, they will be overwritten with the configuration from this import file - {validationResult.warnings.map(error => ( - - {error.message} + {validationResult.warnings.map(warning => ( + + + {warning.message} + - {error.affectedItems.map(item => ( - {item} + {warning.affectedItems.map(item => ( + + {item} + ))} diff --git a/src/lib/app.ts b/src/lib/app.ts index 44f24bca3a..2be2c17110 100644 --- a/src/lib/app.ts +++ b/src/lib/app.ts @@ -26,6 +26,7 @@ import { conditionalMiddleware } from './middleware/conditional-middleware'; import patMiddleware from './middleware/pat-middleware'; import { Knex } from 'knex'; import maintenanceMiddleware from './middleware/maintenance-middleware'; +import { unless } from './middleware/unless-middleware'; export default async function getApp( config: IUnleashConfig, @@ -62,7 +63,17 @@ export default async function getApp( app.use(compression()); app.use(cookieParser()); - app.use(express.json({ strict: false })); + + app.use( + `${baseUriPath}/api/admin/features-batch`, + express.json({ strict: false, limit: '500kB' }), + ); + app.use( + unless( + `${baseUriPath}/api/admin/features-batch`, + express.json({ strict: false }), + ), + ); if (unleashSession) { app.use(unleashSession); } diff --git a/src/lib/middleware/unless-middleware.ts b/src/lib/middleware/unless-middleware.ts new file mode 100644 index 0000000000..709e0f7a00 --- /dev/null +++ b/src/lib/middleware/unless-middleware.ts @@ -0,0 +1,11 @@ +import { RequestHandler } from 'express'; + +export const unless = + (path: string, middleware: RequestHandler): RequestHandler => + (req, res, next) => { + if (path === req.path) { + return next(); + } else { + return middleware(req, res, next); + } + }; diff --git a/src/lib/services/export-import-service.ts b/src/lib/services/export-import-service.ts index 8fdbfca015..6ede6a1d82 100644 --- a/src/lib/services/export-import-service.ts +++ b/src/lib/services/export-import-service.ts @@ -18,12 +18,6 @@ import { ExportQuerySchema } from '../openapi/spec/export-query-schema'; import { FEATURES_EXPORTED, IFlagResolver, IUnleashServices } from '../types'; import { ExportResultSchema } from '../openapi'; -export interface IImportDTO { - data: ExportResultSchema; - project: string; - environment: string; -} - export default class ExportImportService { private logger: Logger;