From 332c860e8022433fc4ae0df0f04457d8a39d64c3 Mon Sep 17 00:00:00 2001 From: Johannes Zellner Date: Tue, 16 Apr 2019 10:29:41 +0200 Subject: [PATCH] If label or tags are present they have to be a specific type --- src/routes/apps.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/routes/apps.js b/src/routes/apps.js index c55e0cdfe..e9ab7e219 100644 --- a/src/routes/apps.js +++ b/src/routes/apps.js @@ -212,8 +212,8 @@ function configureApp(req, res, next) { if (Object.keys(data.env).some(function (key) { return typeof data.env[key] !== 'string'; })) return next(new HttpError(400, 'env must contain values as strings')); } - if (data.label && typeof data.label !== 'string') return next(new HttpError(400, 'label must be a non-empty string')); - if (data.tags) { + if ('label' in data && typeof data.label !== 'string') return next(new HttpError(400, 'label must be a string')); + if ('tags' in data) { if (!Array.isArray(data.tags)) return next(new HttpError(400, 'tags must be an array of strings')); if (data.tags.some(d => typeof d !== 'string')) return next(new HttpError(400, 'tags must be an array of strings')); }