From b58ed6dd4bd375316fca89ce8062fa4a8912d1ed Mon Sep 17 00:00:00 2001 From: mike12345567 Date: Wed, 12 May 2021 14:27:33 +0100 Subject: [PATCH] Fixing an issue with the upload URL not being inserted in correct location. --- packages/worker/src/api/controllers/admin/configs.js | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/packages/worker/src/api/controllers/admin/configs.js b/packages/worker/src/api/controllers/admin/configs.js index 43801ff882..7845eee0d6 100644 --- a/packages/worker/src/api/controllers/admin/configs.js +++ b/packages/worker/src/api/controllers/admin/configs.js @@ -118,16 +118,17 @@ exports.upload = async function (ctx) { // add to configuration structure // TODO: right now this only does a global level const db = new CouchDB(GLOBAL_DB) - let config = await getScopedFullConfig(db, { type }) - if (!config) { - config = { + let cfgStructure = await getScopedFullConfig(db, { type }) + if (!cfgStructure) { + cfgStructure = { _id: generateConfigID({ type }), + config: {}, } } const url = `/${bucket}/${key}` - config[`${name}Url`] = url + cfgStructure.config[`${name}Url`] = url // write back to db with url updated - await db.put(config) + await db.put(cfgStructure) ctx.body = { message: "File has been uploaded and url stored to config.",