From a4f0a7db91b2cd66613678e18d5f6ffe9ec862ba Mon Sep 17 00:00:00 2001 From: Lee Byonghun Date: Wed, 29 May 2024 02:22:00 +0900 Subject: [PATCH] fix: Recognize version that start with v when leading inequality sign (#485) --- crates/version-spec/src/lib.rs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) 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("