fix: handle multiple custom tables
Some checks failed
Test / test (push) Has been cancelled

This commit is contained in:
Yann Amsellem
2025-12-19 19:24:38 +01:00
parent cf3f00fa2c
commit e4eeef6ed3

View File

@@ -48,18 +48,17 @@ export class RemoteEngine extends InternalEventEmitter<Events> implements OLAPEn
}
private getCustomSchemaFromUrl(): Table[] {
const schema = new URLSearchParams(window.location.search).get('schema');
const schemas = new URLSearchParams(window.location.search).getAll('schema');
const replaces = new URLSearchParams(window.location.search).getAll('replace');
if (!schema || !replaces) return [];
if (!schemas.length || !replaces.length) return [];
if (!TABLE_PATTERN.test(schema)) {
if (!schemas.every((s) => TABLE_PATTERN.test(s))) {
console.warn('Bad schema passed');
return [];
}
return schema
.split(';')
return schemas
.map((raw) => {
const [name, _columns] = raw.split(':');
const url = replaces.find((r) => r.startsWith(`${name}:`))?.replace(`${name}:`, '') ?? '';