Fixing an issue with the upload URL not being inserted in correct location.
This commit is contained in:
parent
638e2f5c8e
commit
b58ed6dd4b
|
@ -118,16 +118,17 @@ exports.upload = async function (ctx) {
|
||||||
// add to configuration structure
|
// add to configuration structure
|
||||||
// TODO: right now this only does a global level
|
// TODO: right now this only does a global level
|
||||||
const db = new CouchDB(GLOBAL_DB)
|
const db = new CouchDB(GLOBAL_DB)
|
||||||
let config = await getScopedFullConfig(db, { type })
|
let cfgStructure = await getScopedFullConfig(db, { type })
|
||||||
if (!config) {
|
if (!cfgStructure) {
|
||||||
config = {
|
cfgStructure = {
|
||||||
_id: generateConfigID({ type }),
|
_id: generateConfigID({ type }),
|
||||||
|
config: {},
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
const url = `/${bucket}/${key}`
|
const url = `/${bucket}/${key}`
|
||||||
config[`${name}Url`] = url
|
cfgStructure.config[`${name}Url`] = url
|
||||||
// write back to db with url updated
|
// write back to db with url updated
|
||||||
await db.put(config)
|
await db.put(cfgStructure)
|
||||||
|
|
||||||
ctx.body = {
|
ctx.body = {
|
||||||
message: "File has been uploaded and url stored to config.",
|
message: "File has been uploaded and url stored to config.",
|
||||||
|
|
Loading…
Reference in New Issue