Check if appId is a number before purging

Change-Type: patch
Signed-off-by: Michel Wohlert <michel@1012consulting.io>
This commit is contained in:
Michel Wohlert 2019-11-10 08:02:51 -08:00
parent b62c069583
commit 597f95e169

View File

@ -85,7 +85,13 @@ export function createV2Api(router: Router, applications: ApplicationManager) {
'/v2/applications/:appId/purge',
(req: Request, res: Response, next: NextFunction) => {
const { force } = req.body;
const { appId } = req.params;
const appId = checkInt(req.params.appId);
if (!appId) {
return res.status(400).json({
status: 'failed',
message: 'Missing app id',
});
}
return doPurge(applications, appId, force)
.then(() => {