Skip to content

Commit

Permalink
fix: block remote versions which are not simple versions
Browse files Browse the repository at this point in the history
  • Loading branch information
jdx committed Aug 27, 2024
1 parent e9cc129 commit ba90c3b
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions src/backend/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ use regex::Regex;
use strum::IntoEnumIterator;
use versions::Versioning;

use crate::cli::args::BackendArg;
use crate::cli::args::{BackendArg, ToolVersionType};
use crate::config::{Config, Settings};
use crate::file::{display_path, remove_all, remove_all_with_warning};
use crate::install_context::InstallContext;
Expand Down Expand Up @@ -189,7 +189,18 @@ pub trait Backend: Debug + Send + Sync {
fn list_remote_versions(&self) -> eyre::Result<Vec<String>> {
self.ensure_dependencies_installed()?;
trace!("Listing remote versions for {}", self.fa().to_string());
self._list_remote_versions()
let versions = self
._list_remote_versions()?
.into_iter()
.filter(|v| match v.parse::<ToolVersionType>() {
Ok(ToolVersionType::Version(_)) => true,
_ => {
warn!("Invalid version: {}@{v}", self.id());
false
}
})
.collect();
Ok(versions)
}
fn _list_remote_versions(&self) -> eyre::Result<Vec<String>>;
fn latest_stable_version(&self) -> eyre::Result<Option<String>> {
Expand Down

0 comments on commit ba90c3b

Please sign in to comment.