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