If label or tags are present they have to be a specific type

This commit is contained in:
Johannes Zellner
2019-04-16 10:29:41 +02:00
parent d934671202
commit 332c860e80
+2 -2
View File
@@ -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 (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 ('label' in data && typeof data.label !== 'string') return next(new HttpError(400, 'label must be a string'));
if (data.tags) { if ('tags' in data) {
if (!Array.isArray(data.tags)) return next(new HttpError(400, 'tags must be an array of strings')); 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')); if (data.tags.some(d => typeof d !== 'string')) return next(new HttpError(400, 'tags must be an array of strings'));
} }