Fix value validation
Some checks failed
Build IP lists / Build scanners list (binaryedge) (push) Failing after 11m59s
Build IP lists / Build scanners list (stretchoid) (push) Failing after 19m21s
Build IP lists / build-aws-cloudfront (push) Failing after 26m43s

This commit is contained in:
2024-09-27 20:49:10 +02:00
parent de3b21e210
commit b731f6dc21

View File

@ -272,18 +272,17 @@ impl<'de> Deserialize<'de> for SecurePath {
where
D: Deserializer<'de>,
{
let s = <Vec<String>>::deserialize(deserializer)?;
let k: String = s[0].to_string();
let s = <String>::deserialize(deserializer)?;
// A-Z a-z 0-9
// . - _
if k.chars()
if s.chars()
.all(|c| c.is_ascii_alphanumeric() || c == '.' || c == '-' || c == '_')
{
return Ok(SecurePath { data: k });
return Ok(SecurePath { data: s });
}
Err(serde::de::Error::custom(format!(
"Invalid value: {}",
k.to_string()
s.to_string()
)))
}
}