Change the PUBLIC_API_PREFIX to prevent failures if we increase in the future the API version

This commit is contained in:
jvcalderon 2023-05-12 15:54:44 +02:00
parent 8eac0d99f7
commit a48fc00a54
2 changed files with 7 additions and 1 deletions

View File

@ -172,6 +172,12 @@ describe("utils", () => {
ctx.path = "/api/public/v1" ctx.path = "/api/public/v1"
expectResult(true) expectResult(true)
ctx.path = "/api/public/v2"
expectResult(true)
ctx.path = "/api/public/v21"
expectResult(true)
}) })
it("returns false if current path doesn't remain to public API", async () => { it("returns false if current path doesn't remain to public API", async () => {

View File

@ -19,7 +19,7 @@ const PROD_APP_PREFIX = "/app/"
const BUILDER_PREVIEW_PATH = "/app/preview" const BUILDER_PREVIEW_PATH = "/app/preview"
const BUILDER_PREFIX = "/builder" const BUILDER_PREFIX = "/builder"
const BUILDER_REFERER_PREFIX = `${BUILDER_PREFIX}/app/` const BUILDER_REFERER_PREFIX = `${BUILDER_PREFIX}/app/`
const PUBLIC_API_PREFIX = "/api/public/v1" const PUBLIC_API_PREFIX = "/api/public/v"
function confirmAppId(possibleAppId: string | undefined) { function confirmAppId(possibleAppId: string | undefined) {
return possibleAppId && possibleAppId.startsWith(APP_PREFIX) return possibleAppId && possibleAppId.startsWith(APP_PREFIX)