Merge pull request #12386 from Budibase/fix/views_for_tables_with_whitespaces

Fix views for tables with whitespaces
This commit is contained in:
Michael Drury 2023-11-17 10:27:03 +00:00 committed by GitHub
commit 42e4b63dc2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 5 deletions

View File

@ -53,7 +53,7 @@
selected={isViewActive(view, $isActive, $views, $viewsV2)} selected={isViewActive(view, $isActive, $views, $viewsV2)}
on:click={() => { on:click={() => {
if (view.version === 2) { if (view.version === 2) {
$goto(`./view/v2/${view.id}`) $goto(`./view/v2/${encodeURIComponent(view.id)}`)
} else { } else {
$goto(`./view/v1/${encodeURIComponent(name)}`) $goto(`./view/v1/${encodeURIComponent(name)}`)
} }

View File

@ -5,7 +5,7 @@ export const buildViewV2Endpoints = API => ({
*/ */
fetchDefinition: async viewId => { fetchDefinition: async viewId => {
return await API.get({ 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 => { update: async view => {
return await API.put({ return await API.put({
url: `/api/v2/views/${view.id}`, url: `/api/v2/views/${encodeURIComponent(view.id)}`,
body: view, body: view,
}) })
}, },
@ -50,7 +50,7 @@ export const buildViewV2Endpoints = API => ({
sortType, sortType,
}) => { }) => {
return await API.post({ return await API.post({
url: `/api/v2/views/${viewId}/search`, url: `/api/v2/views/${encodeURIComponent(viewId)}/search`,
body: { body: {
query, query,
paginate, paginate,
@ -67,6 +67,8 @@ export const buildViewV2Endpoints = API => ({
* @param viewId the id of the view * @param viewId the id of the view
*/ */
delete: async viewId => { delete: async viewId => {
return await API.delete({ url: `/api/v2/views/${viewId}` }) return await API.delete({
url: `/api/v2/views/${encodeURIComponent(viewId)}`,
})
}, },
}) })