Browse Source

fix(nocodb): cover title case for validation

pull/5131/head
Wing-Kam Wong 2 years ago
parent
commit
5082c87319
  1. 18
      packages/nocodb/src/lib/meta/api/columnApis.ts

18
packages/nocodb/src/lib/meta/api/columnApis.ts

@ -69,16 +69,20 @@ export async function columnAdd(
const project = await base.getProject(); const project = await base.getProject();
const dbDriver = NcConnectionMgrv2.get(base); if (req.body.title || req.body.column_name) {
const dbDriver = NcConnectionMgrv2.get(base);
const sqlClientType = dbDriver.clientType(); const sqlClientType = dbDriver.clientType();
const mxColumnLength = Column.getMaxColumnNameLength(sqlClientType); const mxColumnLength = Column.getMaxColumnNameLength(sqlClientType);
if (req.body.column_name.length > mxColumnLength) { if ((req.body.title || req.body.column_name).length > mxColumnLength) {
NcError.badRequest( NcError.badRequest(
`Column name ${req.body.column_name} exceeds ${mxColumnLength} characters` `Column name ${
); req.body.title || req.body.column_name
} exceeds ${mxColumnLength} characters`
);
}
} }
if ( if (

Loading…
Cancel
Save