Browse Source

fix(nocodb): cover title case for validation

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

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

@ -69,17 +69,21 @@ export async function columnAdd(
const project = await base.getProject(); const project = await base.getProject();
if (req.body.title || req.body.column_name) {
const dbDriver = NcConnectionMgrv2.get(base); 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 (
!isVirtualCol(req.body) && !isVirtualCol(req.body) &&

Loading…
Cancel
Save