From ac34b8e4f9e3bd74f7764de9bce3c2168e274b30 Mon Sep 17 00:00:00 2001 From: Taku Kodma <79110363+risu729@users.noreply.github.com> Date: Fri, 5 Jun 2026 07:46:31 +1000 Subject: [PATCH 1/2] fix(aqua): avoid double raw windows extensions --- crates/aqua-registry/src/types.rs | 33 ++++++++++++++++++++++++++++++- 1 file changed, 32 insertions(+), 1 deletion(-) diff --git a/crates/aqua-registry/src/types.rs b/crates/aqua-registry/src/types.rs index 4a04e160ac..52d037ad9b 100644 --- a/crates/aqua-registry/src/types.rs +++ b/crates/aqua-registry/src/types.rs @@ -617,7 +617,10 @@ impl AquaPackage { return Ok(s.to_string()); } if self.format == "raw" { - return Ok(self.complete_windows_ext(s)); + if self.os_file_ext_is_empty(s, v) { + return Ok(self.complete_windows_ext(s)); + } + return Ok(s.to_string()); } if !self.format.is_empty() { return Ok(s.to_string()); @@ -1501,6 +1504,20 @@ packages: assert_eq!(url, "https://example.com/tool/1.0.0/tool.jar"); } + #[test] + fn test_url_raw_preserves_custom_windows_ext() { + let pkg = AquaPackage { + url: "https://example.com/tool/{{.Version}}/tool.bat".to_string(), + format: "raw".to_string(), + windows_ext: ".bat".to_string(), + ..Default::default() + }; + + let url = pkg.url("1.0.0", "windows", "amd64").unwrap(); + + assert_eq!(url, "https://example.com/tool/1.0.0/tool.bat"); + } + #[test] fn test_asset_appends_format_ext_by_default() { let pkg = AquaPackage { @@ -1542,6 +1559,20 @@ packages: assert_eq!(asset, "tool-1.0.0-windows-amd64.bat"); } + #[test] + fn test_asset_raw_preserves_custom_windows_ext() { + let pkg = AquaPackage { + asset: "tool-{{.Version}}-{{.OS}}-{{.Arch}}.bat".to_string(), + format: "raw".to_string(), + windows_ext: ".bat".to_string(), + ..Default::default() + }; + + let asset = pkg.asset("1.0.0", "windows", "amd64").unwrap(); + + assert_eq!(asset, "tool-1.0.0-windows-amd64.bat"); + } + #[test] fn test_asset_normalizes_custom_windows_ext() { let pkg = AquaPackage { From 882fa7af01e6e388ee9dfb53d319072af66eed7b Mon Sep 17 00:00:00 2001 From: Taku Kodma <79110363+risu729@users.noreply.github.com> Date: Fri, 5 Jun 2026 15:04:11 +1000 Subject: [PATCH 2/2] docs(aqua): clarify raw windows extension behavior --- crates/aqua-registry/src/types.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/crates/aqua-registry/src/types.rs b/crates/aqua-registry/src/types.rs index 52d037ad9b..87c4c52580 100644 --- a/crates/aqua-registry/src/types.rs +++ b/crates/aqua-registry/src/types.rs @@ -611,7 +611,7 @@ impl AquaPackage { } /// Apply Windows executable extension to an asset or URL string if appropriate. - /// Mirrors upstream aqua's `completeWindowsExtToAsset` decision tree. + /// Keeps already-extended raw assets unchanged to avoid doubling custom Windows extensions. fn complete_windows_ext_to_asset(&self, s: &str, v: &str, os: &str) -> Result { if os != "windows" || s.ends_with(".exe") || s.ends_with(".jar") { return Ok(s.to_string());