From 3818ffd3d3c82b34517a01f498ade0ee3dc3c595 Mon Sep 17 00:00:00 2001 From: Eduard Smet Date: Mon, 16 Mar 2026 19:23:29 +0100 Subject: [PATCH] =?UTF-8?q?feat(plugins):=20Don=E2=80=99t=20treat=20invali?= =?UTF-8?q?d=20VersionReq=20as=20a=20mismatch?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/plugins/registry.rs | 19 ++++++++----------- 1 file changed, 8 insertions(+), 11 deletions(-) diff --git a/src/plugins/registry.rs b/src/plugins/registry.rs index 26219be..b8fdf8d 100644 --- a/src/plugins/registry.rs +++ b/src/plugins/registry.rs @@ -337,7 +337,7 @@ fn get_plugin_matching_version( for plugin_version in plugin_versions { let plugin_version_version = Version::parse(&plugin_version.version)?; - if check_plugin_version_usability(plugin_version) + if check_plugin_version_usability(plugin_version)? && &plugin_version_version > plugin_latest_version .as_ref() @@ -351,7 +351,7 @@ fn get_plugin_matching_version( } else if let Some(plugin_version) = plugin_versions .iter() .find(|v| v.version == requested_version) - && check_plugin_version_usability(plugin_version) + && check_plugin_version_usability(plugin_version)? { return Ok(Some(Version::parse(&plugin_version.version)?)); } @@ -359,24 +359,21 @@ fn get_plugin_matching_version( Ok(None) } -fn check_plugin_version_usability(plugin_version: &RegistryPluginVersion) -> bool { +fn check_plugin_version_usability(plugin_version: &RegistryPluginVersion) -> Result { if let Some(deprecated) = plugin_version.deprecated && deprecated { - return false; + return Ok(false); } - let Ok(plugin_compatible_program_version) = - VersionReq::parse(&plugin_version.compatible_program_version) - else { - return false; - }; + let plugin_compatible_program_version = + VersionReq::parse(&plugin_version.compatible_program_version)?; if !plugin_compatible_program_version.matches(&PROGRAM_VERSION) { - return false; + return Ok(false); } - true + Ok(true) } async fn fetch_registry(