-
-
Notifications
You must be signed in to change notification settings - Fork 3.4k
Description
Describe the bug
I am setting the target explicitly in the updater plugin as described in the custom target docs. I expected this to only affect the target selection within the static JSON file. That is, the target selection in the platforms map in the JSON file. However, setting the target also ends up changing the endpoint URL if the endpoint URL also uses the {{target}} placeholder token.
I have an endpoint URL with the {{target}}-{{arch}} variables, and according to the docs {{target}} is supposed to just be the platform name. So I end up with an endpoint URL https://example.com/darwin-aarch64-aarch64.json because I set the custom target to be the default value of tauri_plugin_updater::target(); which contains both the platform name and the arch.
Other refs:
- https://github.com/tauri-apps/plugins-workspace/blob/v2/plugins/updater/src/updater.rs#L1287
- https://github.com/tauri-apps/plugins-workspace/blob/v2/plugins/updater/src/updater.rs#L428-L429
Reproduction
- Create a new Tauri v2 app with the updater plugin
- Set the custom target (see example code below)
- Create/publish the updater artifacts
Example code for setting custom target:
let target = tauri_plugin_updater::target();
//...
//...
// (skipped some custom Linux bundle type handling code here for brevity)
//...
let updater = match app
.updater_builder()
.target(target_value)
.build()
{
Ok(u) => u,
Err(e) => {
error!(
"desktop.autoupdater.rust - failed to build updater: {} target: {:?}",
e,
tauri_plugin_updater::target().ok_or("unknown"),
);
return Err(Error::Updater(e));
}
};
let update = match updater.check().await {
Ok(update) => update,
Err(e) => {
error!(
"desktop.autoupdater.rust - failed to check for updates: {} target: {:?}",
e,
tauri_plugin_updater::target().ok_or("unknown"),
);
return Err(Error::Updater(e));
}
};Expected behavior
The custom target set in the updater should not affect the {{target}} placeholder token used in the endpoint URL. (Perhaps, a new placeholder variable should be introduced that is just the platform name?)
Full tauri info output
➜ tauri-app git:(main) ✗ npx @tauri-apps/cli info
Need to install the following packages:
@tauri-apps/cli@2.9.6
Ok to proceed? (y) y
[✘] Environment
- OS: Mac OS 26.2.0 arm64 (X64)
✔ Xcode Command Line Tools: installed
✘ Xcode: not installed!
✔ rustc: 1.91.1 (ed61e7d7e 2025-11-07)
✔ cargo: 1.91.1 (ea2d97820 2025-10-10)
✔ rustup: 1.28.2 (e4f3ad6f8 2025-04-28)
✔ Rust toolchain: stable-aarch64-apple-darwin (default)
- node: 22.19.0
- pnpm: 10.18.1
- yarn: 4.10.3
- npm: 10.9.3
- bun: 1.2.5
[-] Packages
- tauri 🦀: 2.9.1, (outdated, latest: 2.9.5)
- tauri-build 🦀: 2.5.3
- wry 🦀: 0.53.5
- tao 🦀: 0.34.5
- @tauri-apps/api ⱼₛ: not installed!
- @tauri-apps/cli ⱼₛ: 2.9.6
[-] Plugins
- tauri-plugin-dialog 🦀: 2.4.2
- @tauri-apps/plugin-dialog ⱼₛ: not installed!
- tauri-plugin-window-state 🦀: 2.4.1
- @tauri-apps/plugin-window-state ⱼₛ: not installed!
- tauri-plugin-updater 🦀: 2.9.0
- @tauri-apps/plugin-updater ⱼₛ: not installed!
- tauri-plugin-process 🦀: 2.3.1
- @tauri-apps/plugin-process ⱼₛ: not installed!
- tauri-plugin-deep-link 🦀: 2.4.5
- @tauri-apps/plugin-deep-link ⱼₛ: not installed!
- tauri-plugin-opener 🦀: 2.5.2
- @tauri-apps/plugin-opener ⱼₛ: not installed!
- tauri-plugin-log 🦀: 2.7.1
- @tauri-apps/plugin-log ⱼₛ: not installed!
- tauri-plugin-http 🦀: 2.5.4
- @tauri-apps/plugin-http ⱼₛ: not installed!
- tauri-plugin-single-instance 🦀: 2.3.6
- @tauri-apps/plugin-single-instance ⱼₛ: not installed!
- tauri-plugin-fs 🦀: 2.4.4
- @tauri-apps/plugin-fs ⱼₛ: not installed!
- tauri-plugin-clipboard-manager 🦀: 2.3.2
- @tauri-apps/plugin-clipboard-manager ⱼₛ: not installed!
- tauri-plugin-shell 🦀: 2.3.3
- @tauri-apps/plugin-shell ⱼₛ: not installed!
- tauri-plugin-sql 🦀: 2.3.1
- @tauri-apps/plugin-sql ⱼₛ: not installed!
[-] App
- build-type: bundle
- CSP: unset
- frontendDist: ../../app/dist/
- devUrl: http://localhost:3333/
- framework: React
Stack trace
Additional context
When a custom target is not specified, the {{target}} placeholder token used in the endpoint URL gets the value of the current OS as reported by updater_os(): https://github.com/tauri-apps/plugins-workspace/blob/v2/plugins/updater/src/updater.rs#L393-L397, which is just the platform name without the arch.