mirror of
https://github.com/Abdulazizzn/n8n-enterprise-unlocked.git
synced 2025-12-18 10:31:15 +00:00
fix(core): Allow strings starting with numbers in alphanumeric string validator (#15425)
This commit is contained in:
committed by
GitHub
parent
ec63a61652
commit
64b3fa3d17
@@ -35,6 +35,8 @@ export const tryToParseString = (value: unknown): string => {
|
||||
};
|
||||
export const tryToParseAlphanumericString = (value: unknown): string => {
|
||||
const parsed = tryToParseString(value);
|
||||
// We do not allow special characters, only letters, numbers and underscore
|
||||
// Numbers not allowed as the first character
|
||||
const regex = /^[a-zA-Z_][a-zA-Z0-9_]*$/;
|
||||
if (!regex.test(parsed)) {
|
||||
throw new ApplicationError('Value is not a valid alphanumeric string', { extra: { value } });
|
||||
|
||||
Reference in New Issue
Block a user