Review comments.
This commit is contained in:
parent
770dde61ec
commit
6be84b81b9
|
@ -62,7 +62,6 @@
|
||||||
if (urlIdx !== -1) {
|
if (urlIdx !== -1) {
|
||||||
existingAppUrls.splice(urlIdx, 1)
|
existingAppUrls.splice(urlIdx, 1)
|
||||||
}
|
}
|
||||||
console.log(existingAppUrls)
|
|
||||||
nameValidation = {
|
nameValidation = {
|
||||||
name: string()
|
name: string()
|
||||||
.required(nameError)
|
.required(nameError)
|
||||||
|
|
|
@ -38,6 +38,8 @@ const {
|
||||||
HostingTypes,
|
HostingTypes,
|
||||||
} = require("../../utilities/builder/hosting")
|
} = require("../../utilities/builder/hosting")
|
||||||
|
|
||||||
|
const URL_REGEX_SLASH = /\/|\\/g
|
||||||
|
|
||||||
// utility function, need to do away with this
|
// utility function, need to do away with this
|
||||||
async function getLayouts(db) {
|
async function getLayouts(db) {
|
||||||
return (
|
return (
|
||||||
|
@ -72,7 +74,7 @@ async function getAppUrlIfNotInUse(ctx) {
|
||||||
} else {
|
} else {
|
||||||
url = encodeURI(`${ctx.request.body.name}`)
|
url = encodeURI(`${ctx.request.body.name}`)
|
||||||
}
|
}
|
||||||
url = `/${url.replace(/\/|\\/g, "")}`.toLowerCase()
|
url = `/${url.replace(URL_REGEX_SLASH, "")}`.toLowerCase()
|
||||||
const hostingInfo = await getHostingInfo()
|
const hostingInfo = await getHostingInfo()
|
||||||
if (hostingInfo.type === HostingTypes.CLOUD) {
|
if (hostingInfo.type === HostingTypes.CLOUD) {
|
||||||
return url
|
return url
|
||||||
|
|
|
@ -3,6 +3,7 @@ const CouchDB = require("../../db")
|
||||||
const env = require("../../environment")
|
const env = require("../../environment")
|
||||||
|
|
||||||
const APP_PREFIX = "app_"
|
const APP_PREFIX = "app_"
|
||||||
|
const URL_REGEX_SLASH = /\/|\\/g
|
||||||
|
|
||||||
exports.getApps = async ctx => {
|
exports.getApps = async ctx => {
|
||||||
let allDbs
|
let allDbs
|
||||||
|
@ -18,7 +19,7 @@ exports.getApps = async ctx => {
|
||||||
const body = {}
|
const body = {}
|
||||||
for (let app of apps) {
|
for (let app of apps) {
|
||||||
let url = app.url || encodeURI(`${app.name}`)
|
let url = app.url || encodeURI(`${app.name}`)
|
||||||
url = `/${url.replace(/\/|\\/g, "")}`
|
url = `/${url.replace(URL_REGEX_SLASH, "")}`
|
||||||
body[url] = {
|
body[url] = {
|
||||||
appId: app._id,
|
appId: app._id,
|
||||||
name: app.name,
|
name: app.name,
|
||||||
|
|
Loading…
Reference in New Issue