From 09bf6833edd20d60a6f8d40fb7948347f7c1a1b1 Mon Sep 17 00:00:00 2001 From: mike12345567 Date: Thu, 14 Jan 2021 17:31:17 +0000 Subject: [PATCH] Making sure URLs are always lower-case. --- packages/builder/src/components/settings/tabs/General.svelte | 2 +- packages/server/src/api/controllers/application.js | 2 +- packages/server/src/api/controllers/static/index.js | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/builder/src/components/settings/tabs/General.svelte b/packages/builder/src/components/settings/tabs/General.svelte index 314b1923ea..55d7312f37 100644 --- a/packages/builder/src/components/settings/tabs/General.svelte +++ b/packages/builder/src/components/settings/tabs/General.svelte @@ -43,7 +43,7 @@ } async function checkUrl(url) { - urlError = await checkValidation({ url }, urlValidation) + urlError = await checkValidation({ url: url.toLowerCase() }, urlValidation) } onMount(async () => { diff --git a/packages/server/src/api/controllers/application.js b/packages/server/src/api/controllers/application.js index 81d68d7e05..eda2a77ee0 100644 --- a/packages/server/src/api/controllers/application.js +++ b/packages/server/src/api/controllers/application.js @@ -72,7 +72,7 @@ async function getAppUrlIfNotInUse(ctx) { } else { url = encodeURI(`${ctx.request.body.name}`) } - url = `/${url.replace(/\/|\\/g, "")}` + url = `/${url.replace(/\/|\\/g, "")}`.toLowerCase() const hostingInfo = await getHostingInfo() if (hostingInfo.type === HostingTypes.CLOUD) { return url diff --git a/packages/server/src/api/controllers/static/index.js b/packages/server/src/api/controllers/static/index.js index 80be9fd683..2ca9d5ce60 100644 --- a/packages/server/src/api/controllers/static/index.js +++ b/packages/server/src/api/controllers/static/index.js @@ -29,7 +29,7 @@ function objectStoreUrl() { async function checkForSelfHostedURL(ctx) { // the "appId" component of the URL may actually be a specific self hosted URL - let possibleAppUrl = `/${encodeURI(ctx.params.appId)}` + let possibleAppUrl = `/${encodeURI(ctx.params.appId).toLowerCase()}` const apps = await getDeployedApps() if (apps[possibleAppUrl] && apps[possibleAppUrl].appId) { return apps[possibleAppUrl].appId