From e68aea03072f67fcda7598eca160951381ea3530 Mon Sep 17 00:00:00 2001 From: Rory Powell Date: Thu, 20 Jan 2022 17:36:54 +0000 Subject: [PATCH] Remove self hosted check --- packages/server/src/api/controllers/static/index.js | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/packages/server/src/api/controllers/static/index.js b/packages/server/src/api/controllers/static/index.js index 51fc2df3e0..f5f05d8068 100644 --- a/packages/server/src/api/controllers/static/index.js +++ b/packages/server/src/api/controllers/static/index.js @@ -37,8 +37,8 @@ async function prepareUpload({ s3Key, bucket, metadata, file }) { } } -async function checkForSelfHostedURL(ctx) { - // the "appId" component of the URL may actually be a specific self hosted URL +async function getAppIdFromUrl(ctx) { + // the "appId" component of the URL can be the id or the custom url let possibleAppUrl = `/${encodeURI(ctx.params.appId).toLowerCase()}` const apps = await getDeployedApps() if (apps[possibleAppUrl] && apps[possibleAppUrl].appId) { @@ -75,10 +75,7 @@ exports.uploadFile = async function (ctx) { } exports.serveApp = async function (ctx) { - let appId = ctx.params.appId - if (env.SELF_HOSTED) { - appId = await checkForSelfHostedURL(ctx) - } + let appId = await getAppIdFromUrl(ctx) const App = require("./templates/BudibaseApp.svelte").default const db = new CouchDB(appId, { skip_setup: true }) const appInfo = await db.get(DocumentTypes.APP_METADATA)