From f114f68021109b9e3f8b39d3598bf272282ab5c9 Mon Sep 17 00:00:00 2001 From: mike12345567 Date: Tue, 16 Mar 2021 13:43:46 +0000 Subject: [PATCH] Fixing issue with applications not being created due to a lack of template file. --- packages/server/src/api/controllers/application.js | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/packages/server/src/api/controllers/application.js b/packages/server/src/api/controllers/application.js index 2023385a7f..9e50319d5d 100644 --- a/packages/server/src/api/controllers/application.js +++ b/packages/server/src/api/controllers/application.js @@ -162,11 +162,14 @@ exports.fetchAppPackage = async function(ctx) { exports.create = async function(ctx) { const { useTemplate, templateKey } = ctx.request.body - const instance = await createInstance({ + const instanceConfig = { useTemplate, key: templateKey, - file: ctx.request.files.templateFile, - }) + } + if (ctx.request.files && ctx.request.files.templateFile) { + instanceConfig.file = ctx.request.files.templateFile + } + const instance = await createInstance(instanceConfig) const url = await getAppUrlIfNotInUse(ctx) const appId = instance._id