Merge pull request #2723 from Budibase/fix/logoupload

Fix/logoupload
This commit is contained in:
Martin McKeaveney 2021-09-23 16:39:12 +01:00 committed by GitHub
commit 429fc8cd5f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 8 additions and 1 deletions

View File

@ -10,6 +10,7 @@ const email = require("../../../utilities/email")
const { upload, ObjectStoreBuckets } = require("@budibase/auth").objectStore const { upload, ObjectStoreBuckets } = require("@budibase/auth").objectStore
const CouchDB = require("../../../db") const CouchDB = require("../../../db")
const { getGlobalDB } = require("@budibase/auth/tenancy") const { getGlobalDB } = require("@budibase/auth/tenancy")
const env = require("../../../environment")
exports.save = async function (ctx) { exports.save = async function (ctx) {
const db = getGlobalDB() const db = getGlobalDB()
@ -174,7 +175,13 @@ exports.upload = async function (ctx) {
const file = ctx.request.files.file const file = ctx.request.files.file
const { type, name } = ctx.params const { type, name } = ctx.params
const bucket = ObjectStoreBuckets.GLOBAL let bucket
if (env.SELF_HOSTED) {
bucket = ObjectStoreBuckets.GLOBAL
} else {
bucket = ObjectStoreBuckets.GLOBAL_CLOUD
}
const key = `${type}/${name}` const key = `${type}/${name}`
await upload({ await upload({
bucket, bucket,