From ac57cdbf028b207a4ce943508de2da7fa0f33129 Mon Sep 17 00:00:00 2001 From: Adria Navarro Date: Fri, 10 Nov 2023 16:16:54 +0100 Subject: [PATCH 1/2] Encode view ids on paths --- packages/frontend-core/src/api/viewsV2.js | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/packages/frontend-core/src/api/viewsV2.js b/packages/frontend-core/src/api/viewsV2.js index 3580d08229..a2072c2e1d 100644 --- a/packages/frontend-core/src/api/viewsV2.js +++ b/packages/frontend-core/src/api/viewsV2.js @@ -5,7 +5,7 @@ export const buildViewV2Endpoints = API => ({ */ fetchDefinition: async viewId => { return await API.get({ - url: `/api/v2/views/${viewId}`, + url: `/api/v2/views/${encodeURIComponent(viewId)}`, }) }, /** @@ -24,7 +24,7 @@ export const buildViewV2Endpoints = API => ({ */ update: async view => { return await API.put({ - url: `/api/v2/views/${view.id}`, + url: `/api/v2/views/${encodeURIComponent(view.id)}`, body: view, }) }, @@ -50,7 +50,7 @@ export const buildViewV2Endpoints = API => ({ sortType, }) => { return await API.post({ - url: `/api/v2/views/${viewId}/search`, + url: `/api/v2/views/${encodeURIComponent(viewId)}/search`, body: { query, paginate, @@ -67,6 +67,8 @@ export const buildViewV2Endpoints = API => ({ * @param viewId the id of the view */ delete: async viewId => { - return await API.delete({ url: `/api/v2/views/${viewId}` }) + return await API.delete({ + url: `/api/v2/views/${encodeURIComponent(viewId)}`, + }) }, }) From 24774f0836f6f9c9723f0cc6356d629474cab641 Mon Sep 17 00:00:00 2001 From: Adria Navarro Date: Fri, 10 Nov 2023 16:33:59 +0100 Subject: [PATCH 2/2] Fix navigation --- .../src/components/backend/TableNavigator/TableNavigator.svelte | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/builder/src/components/backend/TableNavigator/TableNavigator.svelte b/packages/builder/src/components/backend/TableNavigator/TableNavigator.svelte index 056a36c4a7..712d74889c 100644 --- a/packages/builder/src/components/backend/TableNavigator/TableNavigator.svelte +++ b/packages/builder/src/components/backend/TableNavigator/TableNavigator.svelte @@ -53,7 +53,7 @@ selected={isViewActive(view, $isActive, $views, $viewsV2)} on:click={() => { if (view.version === 2) { - $goto(`./view/v2/${view.id}`) + $goto(`./view/v2/${encodeURIComponent(view.id)}`) } else { $goto(`./view/v1/${encodeURIComponent(name)}`) }