Merge pull request #1137 from mwohlert/bugfix/check_appId_before_purging

Check if appId is a number before purging
This commit is contained in:
CameronDiver 2019-11-11 11:11:23 +00:00 committed by GitHub
commit d3a95ed748
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

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