mirror of
https://gitlab.com/xmpp-rs/xmpp-rs.git
synced 2024-07-12 22:21:53 +00:00
Fix datatype validation to be case-sensitive
This commit is contained in:
parent
8c7e9fab85
commit
1d99e9a298
1 changed files with 4 additions and 4 deletions
|
@ -305,11 +305,11 @@ impl FromStr for Datatype {
|
||||||
return Err(Error::Other("Encountered invalid validation datatype.").into());
|
return Err(Error::Other("Encountered invalid validation datatype.").into());
|
||||||
};
|
};
|
||||||
|
|
||||||
let parsed_datatype = match datatype.to_ascii_lowercase().as_str() {
|
let parsed_datatype = match datatype {
|
||||||
"anyuri" => Datatype::AnyUri,
|
"anyURI" => Datatype::AnyUri,
|
||||||
"byte" => Datatype::Byte,
|
"byte" => Datatype::Byte,
|
||||||
"date" => Datatype::Date,
|
"date" => Datatype::Date,
|
||||||
"datetime" => Datatype::DateTime,
|
"dateTime" => Datatype::DateTime,
|
||||||
"decimal" => Datatype::Decimal,
|
"decimal" => Datatype::Decimal,
|
||||||
"double" => Datatype::Double,
|
"double" => Datatype::Double,
|
||||||
"int" => Datatype::Int,
|
"int" => Datatype::Int,
|
||||||
|
@ -362,7 +362,7 @@ mod tests {
|
||||||
#[test]
|
#[test]
|
||||||
fn test_parse_datatype() -> Result<(), Error> {
|
fn test_parse_datatype() -> Result<(), Error> {
|
||||||
assert_eq!(Datatype::AnyUri, "xs:anyURI".parse()?);
|
assert_eq!(Datatype::AnyUri, "xs:anyURI".parse()?);
|
||||||
assert_eq!(Datatype::AnyUri, "xs:anyuri".parse()?);
|
assert!("xs:anyuri".parse::<Datatype>().is_err());
|
||||||
assert!("xs:".parse::<Datatype>().is_err());
|
assert!("xs:".parse::<Datatype>().is_err());
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
Datatype::AnyUri.into_attribute_value(),
|
Datatype::AnyUri.into_attribute_value(),
|
||||||
|
|
Loading…
Reference in a new issue