diff --git a/crates/version-spec/src/lib.rs b/crates/version-spec/src/lib.rs index 454b5ac77..6de3d3a13 100644 --- a/crates/version-spec/src/lib.rs +++ b/crates/version-spec/src/lib.rs @@ -48,7 +48,7 @@ pub fn clean_version_string>(value: T) -> String { } // Remove invalid space after <, <=, >, >=. - let version = regex::Regex::new(r"([><]=?)[ ]+([0-9])") + let version = regex::Regex::new(r"([><]=?)[ ]*v?([0-9])") .unwrap() .replace_all(&version, "$1$2"); @@ -95,6 +95,11 @@ mod tests { assert_eq!(clean_version_string("<1.2.3"), "<1.2.3"); assert_eq!(clean_version_string("<= 1.2.3"), "<=1.2.3"); + assert_eq!(clean_version_string(">= v1.2.3"), ">=1.2.3"); + assert_eq!(clean_version_string("> v1.2.3"), ">1.2.3"); + assert_eq!(clean_version_string("