1
0
Fork 0
mirror of synced 2024-06-16 09:25:12 +12:00

Review comments.

This commit is contained in:
mike12345567 2021-01-18 12:36:49 +00:00
parent 17747c2c7f
commit fcde592385
3 changed files with 5 additions and 3 deletions

View file

@ -62,7 +62,6 @@
if (urlIdx !== -1) {
existingAppUrls.splice(urlIdx, 1)
}
console.log(existingAppUrls)
nameValidation = {
name: string()
.required(nameError)

View file

@ -38,6 +38,8 @@ const {
HostingTypes,
} = require("../../utilities/builder/hosting")
const URL_REGEX_SLASH = /\/|\\/g
// utility function, need to do away with this
async function getLayouts(db) {
return (
@ -72,7 +74,7 @@ async function getAppUrlIfNotInUse(ctx) {
} else {
url = encodeURI(`${ctx.request.body.name}`)
}
url = `/${url.replace(/\/|\\/g, "")}`.toLowerCase()
url = `/${url.replace(URL_REGEX_SLASH, "")}`.toLowerCase()
const hostingInfo = await getHostingInfo()
if (hostingInfo.type === HostingTypes.CLOUD) {
return url

View file

@ -3,6 +3,7 @@ const CouchDB = require("../../db")
const env = require("../../environment")
const APP_PREFIX = "app_"
const URL_REGEX_SLASH = /\/|\\/g
exports.getApps = async ctx => {
let allDbs
@ -18,7 +19,7 @@ exports.getApps = async ctx => {
const body = {}
for (let app of apps) {
let url = app.url || encodeURI(`${app.name}`)
url = `/${url.replace(/\/|\\/g, "")}`
url = `/${url.replace(URL_REGEX_SLASH, "")}`
body[url] = {
appId: app._id,
name: app.name,