@budibase/server 3.26.2 → 3.26.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/yarn.lock CHANGED
@@ -4589,15 +4589,15 @@
4589
4589
  dependencies:
4590
4590
  vary "^1.1.2"
4591
4591
 
4592
- "@koa/router@15.3.0":
4593
- version "15.3.0"
4594
- resolved "https://registry.yarnpkg.com/@koa/router/-/router-15.3.0.tgz#bb58f1f664ade3ac01cd0884391c0a11655b5291"
4595
- integrity sha512-s87hWJjFYky2Z97u8jzah73sSHp4IZivD/2PZCuspHRvcKU69OPLoBIbKigVlBmS50yFTh9GHFfr1hDag4+wXw==
4592
+ "@koa/router@13.1.1":
4593
+ version "13.1.1"
4594
+ resolved "https://registry.yarnpkg.com/@koa/router/-/router-13.1.1.tgz#1291b8adca7f61a31a7f8974d28654654211469d"
4595
+ integrity sha512-JQEuMANYRVHs7lm7KY9PCIjkgJk73h4m4J+g2mkw2Vo1ugPZ17UJVqEH8F+HeAdjKz5do1OaLe7ArDz+z308gw==
4596
4596
  dependencies:
4597
- debug "^4.4.3"
4598
- http-errors "^2.0.1"
4597
+ debug "^4.4.1"
4598
+ http-errors "^2.0.0"
4599
4599
  koa-compose "^4.1.0"
4600
- path-to-regexp "^8.3.0"
4600
+ path-to-regexp "^6.3.0"
4601
4601
 
4602
4602
  "@lerna/create@9.0.3":
4603
4603
  version "9.0.3"
@@ -7764,10 +7764,10 @@
7764
7764
  dependencies:
7765
7765
  "@types/koa" "*"
7766
7766
 
7767
- "@types/koa__router@12.0.5":
7768
- version "12.0.5"
7769
- resolved "https://registry.yarnpkg.com/@types/koa__router/-/koa__router-12.0.5.tgz#4eaab7cf650bea292ae02787d9e1e6b77a31f191"
7770
- integrity sha512-1HeLxuDn4n5it1yZYCSyOYXo++73zT0ffoviXnPxbwbxLbvDFEvWD9ZzpRiIpK4oKR0pi+K+Mk/ZjyROjW3HSw==
7767
+ "@types/koa__router@12.0.4":
7768
+ version "12.0.4"
7769
+ resolved "https://registry.yarnpkg.com/@types/koa__router/-/koa__router-12.0.4.tgz#a1f9afec9dc7e7d9fa1252d1938c44b403e19a28"
7770
+ integrity sha512-Y7YBbSmfXZpa/m5UGGzb7XadJIRBRnwNY9cdAojZGp65Cpe5MAP3mOZE7e3bImt8dfKS4UFcR16SLH8L/z7PBw==
7771
7771
  dependencies:
7772
7772
  "@types/koa" "*"
7773
7773
 
@@ -14634,7 +14634,7 @@ http-errors@^1.6.3, http-errors@^1.7.3, http-errors@~1.8.0:
14634
14634
  statuses ">= 1.5.0 < 2"
14635
14635
  toidentifier "1.0.1"
14636
14636
 
14637
- http-errors@^2.0.1:
14637
+ http-errors@^2.0.0:
14638
14638
  version "2.0.1"
14639
14639
  resolved "https://registry.yarnpkg.com/http-errors/-/http-errors-2.0.1.tgz#36d2f65bc909c8790018dd36fb4d93da6caae06b"
14640
14640
  integrity sha512-4FbRdAX+bSdmo4AUFuS0WNiPz8NgFt+r8ThgNWmlrjQjt1Q7ZR9+zTlce2859x4KSXrwIsaeTqDoKQmtP8pLmQ==
@@ -19568,16 +19568,11 @@ path-to-regexp@0.1.12, path-to-regexp@^0.1.12:
19568
19568
  resolved "https://registry.yarnpkg.com/path-to-regexp/-/path-to-regexp-0.1.12.tgz#d5e1a12e478a976d432ef3c58d534b9923164bb7"
19569
19569
  integrity sha512-RA1GjUVMnvYFxuqovrEqZoxxW5NUZqbwKtYz/Tt7nXerk0LbLblQmrsgdeOxV5SFHf0UDggjS/bSeOZwt1pmEQ==
19570
19570
 
19571
- path-to-regexp@^6.1.0:
19571
+ path-to-regexp@^6.1.0, path-to-regexp@^6.3.0:
19572
19572
  version "6.3.0"
19573
19573
  resolved "https://registry.yarnpkg.com/path-to-regexp/-/path-to-regexp-6.3.0.tgz#2b6a26a337737a8e1416f9272ed0766b1c0389f4"
19574
19574
  integrity sha512-Yhpw4T9C6hPpgPeA28us07OJeqZ5EzQTkbfwuhsUg0c237RomFoETJgmp2sa3F/41gfLE6G5cqcYwznmeEeOlQ==
19575
19575
 
19576
- path-to-regexp@^8.3.0:
19577
- version "8.3.0"
19578
- resolved "https://registry.yarnpkg.com/path-to-regexp/-/path-to-regexp-8.3.0.tgz#aa818a6981f99321003a08987d3cec9c3474cd1f"
19579
- integrity sha512-7jdwVIRtsP8MYpdXSwOS0YdD0Du+qOoF/AEPIt88PcCFrZCzx41oxku1jD88hZBwbNUIEfpqvuhjFaMAqMTWnA==
19580
-
19581
19576
  path-type@^3.0.0:
19582
19577
  version "3.0.0"
19583
19578
  resolved "https://registry.yarnpkg.com/path-type/-/path-type-3.0.0.tgz#cef31dc8e0a1a3bb0d105c0cd97cf3bf47f4e36f"
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@budibase/server",
3
3
  "email": "hi@budibase.com",
4
- "version": "3.26.2",
4
+ "version": "3.26.3",
5
5
  "description": "Budibase Web Server",
6
6
  "main": "src/index.ts",
7
7
  "repository": {
@@ -61,7 +61,7 @@
61
61
  "@elastic/elasticsearch": "7.10.0",
62
62
  "@google-cloud/firestore": "7.8.0",
63
63
  "@koa/cors": "5.0.0",
64
- "@koa/router": "15.3.0",
64
+ "@koa/router": "13.1.1",
65
65
  "@octokit/rest": "^20.0.0",
66
66
  "@socket.io/redis-adapter": "^8.2.1",
67
67
  "@types/xml2js": "^0.4.14",
@@ -148,6 +148,7 @@
148
148
  "@types/koa": "2.13.4",
149
149
  "@types/koa-send": "^4.1.6",
150
150
  "@types/koa__cors": "5.0.0",
151
+ "@types/koa__router": "12.0.4",
151
152
  "@types/lodash": "4.14.200",
152
153
  "@types/mailparser": "^3.4.6",
153
154
  "@types/mssql": "9.1.5",
@@ -225,5 +226,5 @@
225
226
  }
226
227
  }
227
228
  },
228
- "gitHead": "908ec20f1124a11b0cbe3bed8d2bc4a04e856cfe"
229
+ "gitHead": "69ab5e17bf9ccdac19b3bccd30352b936942129a"
229
230
  }
@@ -8,6 +8,5 @@ import send from "koa-send"
8
8
  export const serveBuilderAssets = async function (ctx: Ctx<void, void>) {
9
9
  let topLevelPath = env.isDev() ? DEV_ASSET_PATH : TOP_LEVEL_PATH
10
10
  const builderPath = join(topLevelPath, "builder")
11
- const file = ctx.file || "index.html"
12
- await send(ctx, file, { root: builderPath })
11
+ await send(ctx, ctx.file, { root: builderPath })
13
12
  }
@@ -17,9 +17,7 @@ async function redirect(
17
17
  method: "GET" | "POST" | "DELETE",
18
18
  path = "global"
19
19
  ) {
20
- const devPath = Array.isArray(ctx.params.devPath)
21
- ? ctx.params.devPath.join("/")
22
- : ctx.params.devPath
20
+ const { devPath } = ctx.params
23
21
  const queryString = ctx.originalUrl.split("?")[1] || ""
24
22
  const response = await fetch(
25
23
  checkSlashesInUrl(
@@ -406,9 +406,7 @@ export const serveClientLibrary = async function (
406
406
  }
407
407
 
408
408
  export const serve3rdPartyFile = async function (ctx: Ctx) {
409
- const file = Array.isArray(ctx.params.file)
410
- ? ctx.params.file.join("/")
411
- : ctx.params.file
409
+ const { file } = ctx.params
412
410
 
413
411
  const workspaceId = context.getWorkspaceId()
414
412
  if (!workspaceId) {
@@ -6,7 +6,6 @@ const router: Router = new Router()
6
6
 
7
7
  addFileManagement(router)
8
8
 
9
- router.get("/builder", serveBuilderAssets)
10
- router.get("/builder/*file", serveBuilderAssets)
9
+ router.get("/builder/:file*", serveBuilderAssets)
11
10
 
12
11
  export default router
@@ -4,9 +4,9 @@ import { builderRoutes, publicRoutes } from "./endpointGroups"
4
4
 
5
5
  function redirectPath(path: string) {
6
6
  publicRoutes
7
- .get(`/api/${path}/*devPath`, controller.buildRedirectGet(path))
8
- .post(`/api/${path}/*devPath`, controller.buildRedirectPost(path))
9
- .delete(`/api/${path}/*devPath`, controller.buildRedirectDelete(path))
7
+ .get(`/api/${path}/:devPath(.*)`, controller.buildRedirectGet(path))
8
+ .post(`/api/${path}/:devPath(.*)`, controller.buildRedirectPost(path))
9
+ .delete(`/api/${path}/:devPath(.*)`, controller.buildRedirectDelete(path))
10
10
  }
11
11
 
12
12
  if (env.isDev() || env.isTest()) {
@@ -18,7 +18,7 @@ router
18
18
  ctx.redirect("/builder/bblogo.png")
19
19
  })
20
20
  .get("/api/assets/:appId/client", controller.serveClientLibrary)
21
- .get("/api/assets/:appId/*file", controller.serve3rdPartyFile)
21
+ .get("/api/assets/:appId/:file(.*)", controller.serve3rdPartyFile)
22
22
  .get("/api/apps/:appId/manifest.json", controller.servePwaManifest)
23
23
  .post("/api/attachments/process", authorized(BUILDER), controller.uploadFile)
24
24
  .post("/api/pwa/process-zip", authorized(BUILDER), controller.processPWAZip)
@@ -35,10 +35,8 @@ router
35
35
  controller.serveBuilderPreview
36
36
  )
37
37
  .get("/app/service-worker.js", controller.serveServiceWorker)
38
- .get("/app/:appUrl", controller.serveApp)
39
- .get("/app/:appUrl/*path", controller.serveApp)
40
- .get(`/${devAppIdPath}`, controller.serveApp)
41
- .get(`/${devAppIdPath}/*path`, controller.serveApp)
38
+ .get("/app/:appUrl/:path*", controller.serveApp)
39
+ .get(`/${devAppIdPath}/:path*`, controller.serveApp)
42
40
  .post(
43
41
  "/api/attachments/:datasourceId/url",
44
42
  recaptcha,
package/src/api/utils.ts CHANGED
@@ -6,11 +6,7 @@ import Router from "@koa/router"
6
6
  export function addFileManagement(router: Router) {
7
7
  /* istanbul ignore next */
8
8
  router.param("file", async (file: any, ctx: any, next: () => void) => {
9
- const normalizedFile = Array.isArray(file) ? file.join("/") : file
10
- ctx.file =
11
- normalizedFile && normalizedFile.includes(".")
12
- ? normalizedFile
13
- : "index.html"
9
+ ctx.file = file && file.includes(".") ? file : "index.html"
14
10
  if (!ctx.file.startsWith("budibase-client")) {
15
11
  return next()
16
12
  }
@@ -1,3 +1,3 @@
1
1
  import { DocumentType } from "@budibase/types"
2
2
 
3
- export const devAppIdPath = `${DocumentType.WORKSPACE_DEV}_:appId`
3
+ export const devAppIdPath = `:appId(${DocumentType.WORKSPACE_DEV}_.+)`