Skip to content

armgit / macro

Public Imported from GitHub
0

Macro is a unified workspace for teams: email, chat, docs, tasks, agents, calls, and CRM — @-linked together with shared AI memory.

fix: bundle updater broken path (#6910)

Peter Chinman2d9c62800408
diff --git a/apps/web/tauri/macro_bundle_updater_plugin/src/outbound/api_client.rs b/apps/web/tauri/macro_bundle_updater_plugin/src/outbound/api_client.rs
index 345fc8caa2..bde532e729 100644
--- a/apps/web/tauri/macro_bundle_updater_plugin/src/outbound/api_client.rs
+++ b/apps/web/tauri/macro_bundle_updater_plugin/src/outbound/api_client.rs
@@ -47,6 +47,7 @@ impl BundleClient {
let mut url = self.base.clone();
url.path_segments_mut()
.map_err(|_| BundleClientErr::CannotBeABase(self.base.clone()))?
+ .pop_if_empty()
.push("update")
.push("bundle")
.push(request.target.into())
diff --git a/apps/web/tauri/macro_bundle_updater_plugin/src/outbound/api_client/test.rs b/apps/web/tauri/macro_bundle_updater_plugin/src/outbound/api_client/test.rs
index bc029dc482..10263162ca 100644
--- a/apps/web/tauri/macro_bundle_updater_plugin/src/outbound/api_client/test.rs
+++ b/apps/web/tauri/macro_bundle_updater_plugin/src/outbound/api_client/test.rs
@@ -11,15 +11,28 @@ fn app_info() -> AppInfo {
}
#[test]
-fn update_check_url_preserves_base_path_prefix() {
- let client = BundleClient::new("https://gateway.macro.com/auth/".parse().unwrap());
+fn update_check_url_joins_gateway_prefix_with_or_without_trailing_slash() {
+ // Regression: appending to `/auth/` without removing the empty final segment
+ // produced `/auth//update/...`, which the production gateway rejects with 404.
+ for base in [
+ "https://gateway.macro.com/auth/",
+ "https://gateway.macro.com/auth",
+ ] {
+ let client = BundleClient::new(base.parse().unwrap());
+ let request = AppInfo {
+ current_bundle_build: 1790022571617,
+ native_build: 183,
+ ..app_info()
+ };
- let url = client.update_check_url(app_info()).unwrap();
+ let url = client.update_check_url(request).unwrap();
- assert_eq!(
- url.as_str(),
- "https://gateway.macro.com/auth/update/bundle/ios/aarch64?current_bundle_build=42&native_build=7"
- );
+ assert_eq!(
+ url.as_str(),
+ "https://gateway.macro.com/auth/update/bundle/ios/aarch64?current_bundle_build=1790022571617&native_build=183",
+ "incorrect update URL for base {base}"
+ );
+ }
}
#[test]