Skip to content

Commit

Permalink
fix: mise fails to install kubectl on windows from aqua registry (#4024)
Browse files Browse the repository at this point in the history
* fix: mise fails to install kubectl on windows from aqua registry

* [autofix.ci] apply automated fixes

* [autofix.ci] apply automated fixes (attempt 2/3)

---------

Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
  • Loading branch information
roele and autofix-ci[bot] authored Jan 9, 2025
1 parent b11167b commit 8afa8a4
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 7 deletions.
11 changes: 9 additions & 2 deletions src/aqua/aqua_registry.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ use itertools::Itertools;
use serde_derive::Deserialize;
use std::cmp::PartialEq;
use std::collections::HashMap;
use std::path::PathBuf;
use std::path::{Path, PathBuf};
use std::sync::LazyLock as Lazy;
use url::Url;

Expand Down Expand Up @@ -349,7 +349,14 @@ impl AquaPackage {
}

pub fn url(&self, v: &str) -> Result<String> {
self.parse_aqua_str(&self.url, v, &Default::default())
let mut url = self.url.clone();
if cfg!(windows)
&& Path::new(&url).extension().is_none()
&& (self.format.is_empty() || self.format == "raw")
{
url.push_str(".exe");
}
self.parse_aqua_str(&url, v, &Default::default())
}

fn parse_aqua_str(
Expand Down
5 changes: 0 additions & 5 deletions src/backend/aqua.rs
Original file line number Diff line number Diff line change
Expand Up @@ -533,11 +533,6 @@ impl AquaBackend {
for (src, dst) in self.srcs(pkg, tv)? {
if src != dst && src.exists() && !dst.exists() {
if cfg!(windows) {
let dst = if dst.extension().is_none() {
dst.with_extension("exe")
} else {
dst
};
file::copy(&src, &dst)?;
} else {
let src = PathBuf::from(".").join(src.file_name().unwrap().to_str().unwrap());
Expand Down

0 comments on commit 8afa8a4

Please sign in to comment.