From 1fc56ff1e8e95757bbe72e738932101fe4ce914d Mon Sep 17 00:00:00 2001 From: Daniel Lockyer Date: Mon, 28 Jun 2021 12:16:45 +0100 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9B=20Fixed=20validation=20on=20theme?= =?UTF-8?q?=20install=20API=20parameters?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit fixes https://github.com/TryGhost/Team/issues/818 - validation on query parameters should be wrapped in `options` within `validation` - this is missing from the theme install API endpoint so we don't force the parameters to be passed in - Ghost throws a 500 if `ref` is not supplied because following code assumes we've checked the existence - this commit wraps the two query parameter validation statements in an `options` object to ensure they exist - Ghost returns a 422 if missing --- core/server/api/canary/themes.js | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/core/server/api/canary/themes.js b/core/server/api/canary/themes.js index af95bd94c3..5ccc3ca3fd 100644 --- a/core/server/api/canary/themes.js +++ b/core/server/api/canary/themes.js @@ -66,12 +66,14 @@ module.exports = { 'ref' ], validation: { - source: { - required: true, - values: ['github'] - }, - ref: { - required: true + options: { + source: { + required: true, + values: ['github'] + }, + ref: { + required: true + } } }, permissions: {