Browse Source

fix: trim leading and trailing spaces from column titles

Signed-off-by: mertmit <mertmit99@gmail.com>
pull/6956/head
mertmit 1 year ago
parent
commit
68e168ef0c
  1. 10
      packages/nocodb/src/services/columns.service.ts

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

@ -124,6 +124,11 @@ export class ColumnsService {
param.column.column_name = sanitizeColumnName(param.column.column_name); param.column.column_name = sanitizeColumnName(param.column.column_name);
} }
// trim leading and trailing spaces from column title as knex trim them by default
if (param.column.title) {
param.column.title = param.column.title.trim();
}
if (param.column.column_name) { if (param.column.column_name) {
// - 5 is a buffer for suffix // - 5 is a buffer for suffix
let colName = param.column.column_name.slice(0, mxColumnLength - 5); let colName = param.column.column_name.slice(0, mxColumnLength - 5);
@ -1068,6 +1073,11 @@ export class ColumnsService {
param.column.column_name = sanitizeColumnName(param.column.column_name); param.column.column_name = sanitizeColumnName(param.column.column_name);
} }
// trim leading and trailing spaces from column title as knex trim them by default
if (param.column.title) {
param.column.title = param.column.title.trim();
}
if (param.column.column_name) { if (param.column.column_name) {
// - 5 is a buffer for suffix // - 5 is a buffer for suffix
let colName = param.column.column_name.slice(0, mxColumnLength - 5); let colName = param.column.column_name.slice(0, mxColumnLength - 5);

Loading…
Cancel
Save