fix: issue 292 New version alert was not displayed due to a semver regex issue. (#300)

This commit is contained in:
Christian Visintin
2024-10-14 10:43:47 +02:00
committed by GitHub
parent 7eb913ec7b
commit c05ef32270
4 changed files with 11 additions and 2 deletions

View File

@@ -102,7 +102,7 @@ static REMOTE_SMB_OPT_REGEX: Lazy<Regex> =
* - group 1: Version
* E.g. termscp-0.3.2 => 0.3.2; v0.4.0 => 0.4.0
*/
static SEMVER_REGEX: Lazy<Regex> = lazy_regex!(r".*(:?[0-9]\.[0-9]\.[0-9])");
static SEMVER_REGEX: Lazy<Regex> = lazy_regex!(r"v?((0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*))");
/**
* Regex matches:
@@ -835,6 +835,8 @@ mod tests {
assert_eq!(parse_semver("v0.4.1").unwrap(), String::from("0.4.1"),);
assert_eq!(parse_semver("1.0.0").unwrap(), String::from("1.0.0"),);
assert!(parse_semver("v1.1").is_none());
assert_eq!(parse_semver("10.15.10"), Some("10.15.10".to_string()));
}
#[test]