Browse Source

fix: handle whitespace/special char in column/table in gql

Signed-off-by: Pranav C <pranavxc@gmail.com>
pull/843/head
Pranav C 3 years ago
parent
commit
e9bc27faf4
  1. 7
      packages/nocodb/src/lib/noco/common/BaseApiBuilder.ts

7
packages/nocodb/src/lib/noco/common/BaseApiBuilder.ts

@ -1671,13 +1671,14 @@ export default abstract class BaseApiBuilder<T extends Noco>
}
// table alias functions
protected getInflectedName(name: string, inflectionFns: string): string {
protected getInflectedName(_name: string, inflectionFns: string): string {
let name = _name;
if (inflectionFns && inflectionFns !== 'none') {
return inflectionFns
name = inflectionFns
.split(',')
.reduce((out, fn) => inflection?.[fn]?.(out) ?? out, name);
}
return name;
return this.apiType === 'graphql' ? name.replace(/[^_\da-z]/gi, '_') : name;
}
protected async getColumnList(tn: string): Promise<any[]> {

Loading…
Cancel
Save