From 1d99e9a29817554b4d002d0d2b47800aa6a78b95 Mon Sep 17 00:00:00 2001 From: mb Date: Mon, 24 Jun 2024 15:57:51 +0200 Subject: [PATCH] Fix datatype validation to be case-sensitive --- parsers/src/data_forms/validate.rs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/parsers/src/data_forms/validate.rs b/parsers/src/data_forms/validate.rs index dbe2c4e1..e2e3e518 100644 --- a/parsers/src/data_forms/validate.rs +++ b/parsers/src/data_forms/validate.rs @@ -305,11 +305,11 @@ impl FromStr for Datatype { return Err(Error::Other("Encountered invalid validation datatype.").into()); }; - let parsed_datatype = match datatype.to_ascii_lowercase().as_str() { - "anyuri" => Datatype::AnyUri, + let parsed_datatype = match datatype { + "anyURI" => Datatype::AnyUri, "byte" => Datatype::Byte, "date" => Datatype::Date, - "datetime" => Datatype::DateTime, + "dateTime" => Datatype::DateTime, "decimal" => Datatype::Decimal, "double" => Datatype::Double, "int" => Datatype::Int, @@ -362,7 +362,7 @@ mod tests { #[test] fn test_parse_datatype() -> Result<(), Error> { assert_eq!(Datatype::AnyUri, "xs:anyURI".parse()?); - assert_eq!(Datatype::AnyUri, "xs:anyuri".parse()?); + assert!("xs:anyuri".parse::().is_err()); assert!("xs:".parse::().is_err()); assert_eq!( Datatype::AnyUri.into_attribute_value(),