From 16581552cb78d3e4e18c5a250fda729b9ca31ec1 Mon Sep 17 00:00:00 2001 From: mike12345567 Date: Mon, 5 Jul 2021 15:14:45 +0100 Subject: [PATCH 1/3] Fixing issue with single quotes in strings breaking JSON parsing. --- packages/server/src/integrations/utils.ts | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/packages/server/src/integrations/utils.ts b/packages/server/src/integrations/utils.ts index 968d9da58e..36880ab913 100644 --- a/packages/server/src/integrations/utils.ts +++ b/packages/server/src/integrations/utils.ts @@ -25,6 +25,8 @@ export function generateRowIdField(keyProps: any[] = []) { keyProps = [keyProps] } // this conserves order and types + // we have to swap the double quotes to single quotes for use in HBS statements + // when using the literal helper the double quotes can break things return encodeURIComponent(JSON.stringify(keyProps).replace(/"/g, "'")) } @@ -33,7 +35,11 @@ export function breakRowIdField(_id: string) { if (!_id) { return null } - return JSON.parse(decodeURIComponent(_id)) + // have to replace on the way back as we swapped out the double quotes + // when encoding, but JSON can't handle the single quotes + const decoded = decodeURIComponent(_id).replace(/'/g, "\"") + const parsed = JSON.parse(decoded) + return Array.isArray(parsed) ? parsed : [parsed] } export function convertType(type: string, map: { [key: string]: any }) { From ca1c48232b3ec8957b520a223a0b1c271846432f Mon Sep 17 00:00:00 2001 From: mike12345567 Date: Mon, 5 Jul 2021 15:16:32 +0100 Subject: [PATCH 2/3] Linting. --- packages/server/src/integrations/utils.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/server/src/integrations/utils.ts b/packages/server/src/integrations/utils.ts index 36880ab913..87ed185ba3 100644 --- a/packages/server/src/integrations/utils.ts +++ b/packages/server/src/integrations/utils.ts @@ -37,7 +37,7 @@ export function breakRowIdField(_id: string) { } // have to replace on the way back as we swapped out the double quotes // when encoding, but JSON can't handle the single quotes - const decoded = decodeURIComponent(_id).replace(/'/g, "\"") + const decoded = decodeURIComponent(_id).replace(/'/g, '"') const parsed = JSON.parse(decoded) return Array.isArray(parsed) ? parsed : [parsed] } From 1532fee30146e988cad26fbd416facd264c45542 Mon Sep 17 00:00:00 2001 From: Budibase Release Bot <> Date: Mon, 5 Jul 2021 14:38:21 +0000 Subject: [PATCH 3/3] v0.9.70 --- lerna.json | 2 +- packages/auth/package.json | 2 +- packages/bbui/package.json | 2 +- packages/builder/package.json | 8 ++++---- packages/cli/package.json | 2 +- packages/client/package.json | 8 ++++---- packages/server/package.json | 10 +++++----- packages/standard-components/package.json | 4 ++-- packages/string-templates/package.json | 2 +- packages/worker/package.json | 6 +++--- 10 files changed, 23 insertions(+), 23 deletions(-) diff --git a/lerna.json b/lerna.json index f5c82b9cb7..c35a2dbdc9 100644 --- a/lerna.json +++ b/lerna.json @@ -1,5 +1,5 @@ { - "version": "0.9.69", + "version": "0.9.70", "npmClient": "yarn", "packages": [ "packages/*" diff --git a/packages/auth/package.json b/packages/auth/package.json index 9581a4ce1f..650d41b633 100644 --- a/packages/auth/package.json +++ b/packages/auth/package.json @@ -1,6 +1,6 @@ { "name": "@budibase/auth", - "version": "0.9.69", + "version": "0.9.70", "description": "Authentication middlewares for budibase builder and apps", "main": "src/index.js", "author": "Budibase", diff --git a/packages/bbui/package.json b/packages/bbui/package.json index f7bb019803..9b2b2823ef 100644 --- a/packages/bbui/package.json +++ b/packages/bbui/package.json @@ -1,7 +1,7 @@ { "name": "@budibase/bbui", "description": "A UI solution used in the different Budibase projects.", - "version": "0.9.69", + "version": "0.9.70", "license": "AGPL-3.0", "svelte": "src/index.js", "module": "dist/bbui.es.js", diff --git a/packages/builder/package.json b/packages/builder/package.json index e2712c6bed..c13f883a3d 100644 --- a/packages/builder/package.json +++ b/packages/builder/package.json @@ -1,6 +1,6 @@ { "name": "@budibase/builder", - "version": "0.9.69", + "version": "0.9.70", "license": "AGPL-3.0", "private": true, "scripts": { @@ -65,10 +65,10 @@ } }, "dependencies": { - "@budibase/bbui": "^0.9.69", - "@budibase/client": "^0.9.69", + "@budibase/bbui": "^0.9.70", + "@budibase/client": "^0.9.70", "@budibase/colorpicker": "1.1.2", - "@budibase/string-templates": "^0.9.69", + "@budibase/string-templates": "^0.9.70", "@sentry/browser": "5.19.1", "@spectrum-css/page": "^3.0.1", "@spectrum-css/vars": "^3.0.1", diff --git a/packages/cli/package.json b/packages/cli/package.json index b80607af40..e4b1cba6c0 100644 --- a/packages/cli/package.json +++ b/packages/cli/package.json @@ -1,6 +1,6 @@ { "name": "@budibase/cli", - "version": "0.9.69", + "version": "0.9.70", "description": "Budibase CLI, for developers, self hosting and migrations.", "main": "src/index.js", "bin": { diff --git a/packages/client/package.json b/packages/client/package.json index 2ac54c9b7b..917c8c10bd 100644 --- a/packages/client/package.json +++ b/packages/client/package.json @@ -1,6 +1,6 @@ { "name": "@budibase/client", - "version": "0.9.69", + "version": "0.9.70", "license": "MPL-2.0", "module": "dist/budibase-client.js", "main": "dist/budibase-client.js", @@ -18,9 +18,9 @@ "dev:builder": "rollup -cw" }, "dependencies": { - "@budibase/bbui": "^0.9.69", - "@budibase/standard-components": "^0.9.69", - "@budibase/string-templates": "^0.9.69", + "@budibase/bbui": "^0.9.70", + "@budibase/standard-components": "^0.9.70", + "@budibase/string-templates": "^0.9.70", "regexparam": "^1.3.0", "shortid": "^2.2.15", "svelte-spa-router": "^3.0.5" diff --git a/packages/server/package.json b/packages/server/package.json index 95df6cca24..c080cf1f5b 100644 --- a/packages/server/package.json +++ b/packages/server/package.json @@ -1,7 +1,7 @@ { "name": "@budibase/server", "email": "hi@budibase.com", - "version": "0.9.69", + "version": "0.9.70", "description": "Budibase Web Server", "main": "src/index.js", "repository": { @@ -59,9 +59,9 @@ "author": "Budibase", "license": "AGPL-3.0-or-later", "dependencies": { - "@budibase/auth": "^0.9.69", - "@budibase/client": "^0.9.69", - "@budibase/string-templates": "^0.9.69", + "@budibase/auth": "^0.9.70", + "@budibase/client": "^0.9.70", + "@budibase/string-templates": "^0.9.70", "@elastic/elasticsearch": "7.10.0", "@koa/router": "8.0.0", "@sendgrid/mail": "7.1.1", @@ -114,7 +114,7 @@ "devDependencies": { "@babel/core": "^7.14.3", "@babel/preset-env": "^7.14.4", - "@budibase/standard-components": "^0.9.69", + "@budibase/standard-components": "^0.9.70", "@jest/test-sequencer": "^24.8.0", "@types/bull": "^3.15.1", "@types/jest": "^26.0.23", diff --git a/packages/standard-components/package.json b/packages/standard-components/package.json index 239525c765..5268004438 100644 --- a/packages/standard-components/package.json +++ b/packages/standard-components/package.json @@ -29,11 +29,11 @@ "keywords": [ "svelte" ], - "version": "0.9.69", + "version": "0.9.70", "license": "MIT", "gitHead": "d1836a898cab3f8ab80ee6d8f42be1a9eed7dcdc", "dependencies": { - "@budibase/bbui": "^0.9.69", + "@budibase/bbui": "^0.9.70", "@spectrum-css/link": "^3.1.3", "@spectrum-css/page": "^3.0.1", "@spectrum-css/vars": "^3.0.1", diff --git a/packages/string-templates/package.json b/packages/string-templates/package.json index fcfb2ff9b3..78f822028c 100644 --- a/packages/string-templates/package.json +++ b/packages/string-templates/package.json @@ -1,6 +1,6 @@ { "name": "@budibase/string-templates", - "version": "0.9.69", + "version": "0.9.70", "description": "Handlebars wrapper for Budibase templating.", "main": "src/index.cjs", "module": "dist/bundle.mjs", diff --git a/packages/worker/package.json b/packages/worker/package.json index e7f6cc5a59..d6ce2edce1 100644 --- a/packages/worker/package.json +++ b/packages/worker/package.json @@ -1,7 +1,7 @@ { "name": "@budibase/worker", "email": "hi@budibase.com", - "version": "0.9.69", + "version": "0.9.70", "description": "Budibase background service", "main": "src/index.js", "repository": { @@ -21,8 +21,8 @@ "author": "Budibase", "license": "AGPL-3.0-or-later", "dependencies": { - "@budibase/auth": "^0.9.69", - "@budibase/string-templates": "^0.9.69", + "@budibase/auth": "^0.9.70", + "@budibase/string-templates": "^0.9.70", "@koa/router": "^8.0.0", "aws-sdk": "^2.811.0", "bcryptjs": "^2.4.3",