Browse Source

fix: allow special characters in column aliases

pull/6626/head
mertmit 1 year ago
parent
commit
3121442c78
  1. 13
      packages/nocodb/src/services/columns.service.ts

13
packages/nocodb/src/services/columns.service.ts

@ -80,6 +80,11 @@ async function reuseOrSave(
return res;
}
const nc_sanitizeName = (name) => {
// replace all special characters by _
return name.replace(/\W+/g, '_').trim();
};
@Injectable()
export class ColumnsService {
constructor(
@ -127,6 +132,10 @@ export class ColumnsService {
);
}
if (!isVirtualCol(param.column)) {
param.column.column_name = nc_sanitizeName(param.column.column_name);
}
if (
!isVirtualCol(param.column) &&
!(await Column.checkTitleAvailable({
@ -1045,6 +1054,10 @@ export class ColumnsService {
}
}
if (!isVirtualCol(param.column)) {
param.column.column_name = nc_sanitizeName(param.column.column_name);
}
if (
!isVirtualCol(param.column) &&
!(await Column.checkTitleAvailable({

Loading…
Cancel
Save