diff --git a/.changes/updater-endpoint-version-encoded.md b/.changes/updater-endpoint-version-encoded.md new file mode 100644 index 00000000000..e248a0026a2 --- /dev/null +++ b/.changes/updater-endpoint-version-encoded.md @@ -0,0 +1,5 @@ +--- +'tauri': 'patch:bug' +--- + +Encode `+` when making updater requests which can be cause incorrectly interpolating the endpoint when using `{{current_version}}` in the endpoint where the current version contains a build number, for example `1.8.0+1`. diff --git a/core/tauri/src/updater/core.rs b/core/tauri/src/updater/core.rs index 13a40936f98..ae931b39299 100644 --- a/core/tauri/src/updater/core.rs +++ b/core/tauri/src/updater/core.rs @@ -15,6 +15,7 @@ use http::{ HeaderMap, StatusCode, }; use minisign_verify::{PublicKey, Signature}; +use percent_encoding::{AsciiSet, CONTROLS}; use semver::Version; use serde::{de::Error as DeError, Deserialize, Deserializer, Serialize}; use tauri_utils::{platform::current_exe, Env}; @@ -374,8 +375,12 @@ impl UpdateBuilder { // https://releases.myapp.com/update/darwin/aarch64/1.0.0 // The main objective is if the update URL is defined via the Cargo.toml // the URL will be generated dynamically + let version = self.current_version.to_string(); + const CONTROLS_ADD: &AsciiSet = &CONTROLS.add(b'+'); + let encoded_version = percent_encoding::percent_encode(version.as_bytes(), CONTROLS_ADD); + let fixed_link = url - .replace("{{current_version}}", &self.current_version.to_string()) + .replace("{{current_version}}", &encoded_version.to_string()) .replace("{{target}}", &target) .replace("{{arch}}", arch);