From 6822f6e84c037d19ccb71cc45757470771fbd3b3 Mon Sep 17 00:00:00 2001 From: IronBatman2715 <72224765+IronBatman2715@users.noreply.github.com> Date: Mon, 2 Sep 2024 12:18:42 -0400 Subject: [PATCH] Make partition_types::Type::FromStr case-insensitive for guid --- src/macros.rs | 2 +- src/partition_types.rs | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/src/macros.rs b/src/macros.rs index c1bfc09..00447a9 100644 --- a/src/macros.rs +++ b/src/macros.rs @@ -29,7 +29,7 @@ pub mod pub_macros { impl FromStr for Type { type Err = String; fn from_str(s: &str) -> Result { - match s { + match s.to_ascii_uppercase().as_str() { $( $guid | stringify!($upcase) => Ok($upcase), diff --git a/src/partition_types.rs b/src/partition_types.rs index 05855c3..0c93c6b 100644 --- a/src/partition_types.rs +++ b/src/partition_types.rs @@ -352,6 +352,12 @@ mod tests { Type::from_str("00000000-0000-0000-0000-000000000000").unwrap(), UNUSED ); + + // test case sensitivity + assert_eq!( + Type::from_str("ebd0a0a2-b9e5-4433-87c0-68b6b72699c7").unwrap(), + BASIC + ); } #[test]