mirror of
https://github.com/mountain-loop/yaak.git
synced 2026-04-20 07:51:20 +02:00
Merge branch 'main' of github.com:turchinc/yaak into turchinc/main
This commit is contained in:
@@ -323,7 +323,7 @@ impl Parser {
|
|||||||
let is_valid = if start_pos == self.pos {
|
let is_valid = if start_pos == self.pos {
|
||||||
ch.is_alphanumeric() || ch == '_' // The first char is more restrictive
|
ch.is_alphanumeric() || ch == '_' // The first char is more restrictive
|
||||||
} else {
|
} else {
|
||||||
ch.is_alphanumeric() || ch == '_' || ch == '-'
|
ch.is_alphanumeric() || ch == '_' || ch == '-' || ch == '.'
|
||||||
};
|
};
|
||||||
if is_valid {
|
if is_valid {
|
||||||
text.push(ch);
|
text.push(ch);
|
||||||
@@ -545,6 +545,22 @@ mod tests {
|
|||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn var_dots() -> Result<()> {
|
||||||
|
let mut p = Parser::new("${[ a.b ]}");
|
||||||
|
assert_eq!(
|
||||||
|
p.parse()?.tokens,
|
||||||
|
vec![
|
||||||
|
Token::Tag {
|
||||||
|
val: Val::Var { name: "a.b".into() }
|
||||||
|
},
|
||||||
|
Token::Eof
|
||||||
|
]
|
||||||
|
);
|
||||||
|
|
||||||
|
Ok(())
|
||||||
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn var_prefixes() -> Result<()> {
|
fn var_prefixes() -> Result<()> {
|
||||||
let mut p = Parser::new("${[ -a ]}${[ $a ]}");
|
let mut p = Parser::new("${[ -a ]}${[ $a ]}");
|
||||||
|
|||||||
@@ -74,7 +74,7 @@ export function EnvironmentEditor({ environment, hideName, className, setRef }:
|
|||||||
const validateName = useCallback((name: string) => {
|
const validateName = useCallback((name: string) => {
|
||||||
// Empty just means the variable doesn't have a name yet and is unusable
|
// Empty just means the variable doesn't have a name yet and is unusable
|
||||||
if (name === '') return true;
|
if (name === '') return true;
|
||||||
return name.match(/^[a-z_][a-z0-9_-]*$/i) != null;
|
return name.match(/^[a-z_][a-z0-9_.-]*$/i) != null;
|
||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
const valueType = !isEncryptionEnabled && valueVisibility.value ? 'text' : 'password';
|
const valueType = !isEncryptionEnabled && valueVisibility.value ? 'text' : 'password';
|
||||||
|
|||||||
Reference in New Issue
Block a user