diff --git a/CHANGELOG.md b/CHANGELOG.md index 5465a236..a1e10e60 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -52,6 +52,8 @@ Released on - [Issue 290](https://github.com/veeso/termscp/issues/290): Password prompt was broken - [Issue 298](https://github.com/veeso/termscp/issues/298): tuirealm 2.x - Fixed some performance issues where sometimes the app froze for a couple of seconds, thanks to this . +- [Issue 292](https://github.com/veeso/termscp/issues/292): New version alert was not displayed due to a semver regex issue. +- Logging: filter out messages not related to termscp or remotefs ## 0.15.0 diff --git a/src/system/auto_update.rs b/src/system/auto_update.rs index 80e78908..37adacce 100644 --- a/src/system/auto_update.rs +++ b/src/system/auto_update.rs @@ -85,6 +85,7 @@ impl Update { /// In case received version is newer than current one, version as Some is returned; otherwise None fn check_version(r: Release) -> Option { + debug!("got version from GitHub: {}", r.version); match parse_semver(r.version.as_str()) { Some(new_version) => { // Check if version is different diff --git a/src/system/logging.rs b/src/system/logging.rs index 00641fef..fb9bcc3a 100644 --- a/src/system/logging.rs +++ b/src/system/logging.rs @@ -25,7 +25,11 @@ pub fn init(level: LogLevel) -> Result<(), String> { let file = open_file(log_file_path.as_path(), true, true, false) .map_err(|e| format!("Failed to open file {}: {}", log_file_path.display(), e))?; // Prepare log config - let config = ConfigBuilder::new().set_time_format_rfc3339().build(); + let config = ConfigBuilder::new() + .set_time_format_rfc3339() + .add_filter_allow_str("termscp") + .add_filter_allow_str("remotefs") + .build(); // Make logger WriteLogger::init(level, config, file).map_err(|e| format!("Failed to initialize logger: {e}")) } diff --git a/src/utils/parser.rs b/src/utils/parser.rs index 9f5d3bad..a3d8c702 100644 --- a/src/utils/parser.rs +++ b/src/utils/parser.rs @@ -102,7 +102,7 @@ static REMOTE_SMB_OPT_REGEX: Lazy = * - group 1: Version * E.g. termscp-0.3.2 => 0.3.2; v0.4.0 => 0.4.0 */ -static SEMVER_REGEX: Lazy = lazy_regex!(r".*(:?[0-9]\.[0-9]\.[0-9])"); +static SEMVER_REGEX: Lazy = 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]