Skip to content

Commit 47a93dc

Browse files
committed
fix: validate column names to prevent leading or trailing spaces
1 parent 7d7345c commit 47a93dc

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

adminforth/modules/configValidator.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -487,6 +487,10 @@ export default class ConfigValidator implements IConfigValidator {
487487

488488
col.required = typeof inCol.required === 'boolean' ? { create: inCol.required, edit: inCol.required } : inCol.required;
489489

490+
if (col.name.trim() !== col.name) {
491+
errors.push(`Resource "${res.resourceId}" column name "${col.name}" must not have leading or trailing spaces`);
492+
}
493+
490494
// check for duplicate column names
491495
if (resInput.columns.findIndex((c) => c.name === col.name) !== inColIndex) {
492496
errors.push(`Resource "${res.resourceId}" has duplicate column name "${col.name}"`);
@@ -1273,4 +1277,4 @@ export default class ConfigValidator implements IConfigValidator {
12731277
}
12741278
});
12751279
}
1276-
}
1280+
}

0 commit comments

Comments
 (0)