mirror of
https://github.com/usebruno/bruno.git
synced 2025-08-14 12:48:58 +02:00
feat(#931): relax var name strictness
This commit is contained in:
@ -1,7 +1,7 @@
|
||||
const Handlebars = require('handlebars');
|
||||
const { cloneDeep } = require('lodash');
|
||||
|
||||
const envVariableNameRegex = /^(?!\d)[\w-.]*$/;
|
||||
const variableNameRegex = /^[\w-.]*$/;
|
||||
|
||||
class Bru {
|
||||
constructor(envVariables, collectionVariables, processEnvVars, collectionPath) {
|
||||
@ -61,10 +61,10 @@ class Bru {
|
||||
throw new Error('Creating a variable without specifying a name is not allowed.');
|
||||
}
|
||||
|
||||
if (envVariableNameRegex.test(key) === false) {
|
||||
if (variableNameRegex.test(key) === false) {
|
||||
throw new Error(
|
||||
`Variable name: "${key}" contains invalid characters!` +
|
||||
' Names must only contain alpha-numeric characters, "-", "_", "." and cannot start with a digit.'
|
||||
' Names must only contain alpha-numeric characters, "-", "_", "."'
|
||||
);
|
||||
}
|
||||
|
||||
@ -72,10 +72,10 @@ class Bru {
|
||||
}
|
||||
|
||||
getVar(key) {
|
||||
if (envVariableNameRegex.test(key) === false) {
|
||||
if (variableNameRegex.test(key) === false) {
|
||||
throw new Error(
|
||||
`Variable name: "${key}" contains invalid characters!` +
|
||||
' Names must only contain alpha-numeric characters, "-", "_", "." and cannot start with a digit.'
|
||||
' Names must only contain alpha-numeric characters, "-", "_", "."'
|
||||
);
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user