Fix encodings
This commit is contained in:
parent
6f4f114796
commit
15f2aaf950
|
@ -70,6 +70,10 @@ export function encodeTableId(tableId: string) {
|
|||
}
|
||||
}
|
||||
|
||||
export function encodeViewId(viewId: string) {
|
||||
return encodeURIComponent(viewId)
|
||||
}
|
||||
|
||||
export function breakExternalTableId(tableId: string) {
|
||||
const parts = tableId.split(DOUBLE_SEPARATOR)
|
||||
let datasourceId = parts.shift()
|
||||
|
|
|
@ -66,7 +66,7 @@ export function getSourceId(ctx: Ctx): { tableId: string; viewId?: string } {
|
|||
if (docIds.isViewId(sourceId)) {
|
||||
return {
|
||||
tableId: utils.extractViewInfoFromID(sourceId).tableId,
|
||||
viewId: sourceId,
|
||||
viewId: sql.utils.encodeViewId(sourceId),
|
||||
}
|
||||
}
|
||||
return { tableId: sql.utils.encodeTableId(ctx.params.sourceId) }
|
||||
|
|
|
@ -1,10 +1,4 @@
|
|||
import {
|
||||
context,
|
||||
db as dbCore,
|
||||
docIds,
|
||||
utils,
|
||||
sql,
|
||||
} from "@budibase/backend-core"
|
||||
import { context, db as dbCore, docIds, utils } from "@budibase/backend-core"
|
||||
import {
|
||||
DatabaseQueryOpts,
|
||||
Datasource,
|
||||
|
@ -334,7 +328,7 @@ export function extractViewInfoFromID(viewId: string) {
|
|||
const regex = new RegExp(`^(?<tableId>.+)${SEPARATOR}([^${SEPARATOR}]+)$`)
|
||||
const res = regex.exec(viewId)
|
||||
return {
|
||||
tableId: sql.utils.encodeTableId(res!.groups!["tableId"]),
|
||||
tableId: res!.groups!["tableId"],
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue