sanitizing client lib URL
This commit is contained in:
parent
b5da856c64
commit
064f1e961b
|
@ -34,11 +34,15 @@ function sanitizeKey(input) {
|
|||
return sanitize(sanitizeBucket(input)).replace(/\\/g, "/")
|
||||
}
|
||||
|
||||
exports.sanitizeKey = sanitizeKey
|
||||
|
||||
// simply handles the dev app to app conversion
|
||||
function sanitizeBucket(input) {
|
||||
return input.replace(new RegExp(APP_DEV_PREFIX, "g"), APP_PREFIX)
|
||||
}
|
||||
|
||||
exports.sanitizeBucket = sanitizeBucket
|
||||
|
||||
function publicPolicy(bucketName) {
|
||||
return {
|
||||
Version: "2012-10-17",
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
const env = require("../environment")
|
||||
const { OBJ_STORE_DIRECTORY, ObjectStoreBuckets } = require("../constants")
|
||||
const { getAllApps } = require("@budibase/auth/db")
|
||||
const { sanitizeKey } = require("@budibase/auth/src/objectStore")
|
||||
|
||||
const BB_CDN = "https://cdn.app.budi.live/assets"
|
||||
|
||||
|
@ -43,7 +44,9 @@ exports.objectStoreUrl = () => {
|
|||
*/
|
||||
exports.clientLibraryPath = appId => {
|
||||
if (env.isProd()) {
|
||||
return `${exports.objectStoreUrl()}/${appId}/budibase-client.js`
|
||||
return `${exports.objectStoreUrl()}/${sanitizeKey(
|
||||
appId
|
||||
)}/budibase-client.js`
|
||||
} else {
|
||||
return `/api/assets/client`
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue