fix(updater): Escape msi path string (#1495)

* fix(updater): Escape msi path string

* fmt
pull/1496/head
Fabian-Lars 11 months ago committed by GitHub
parent 9db5a6a0f5
commit 29751ee939
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -0,0 +1,5 @@
---
"updater": patch
---
On Windows, escape the path to the downloaded msi updater to fix an issue causing the update to fail when the `productName` contained spaces.

@ -2,7 +2,13 @@
// SPDX-License-Identifier: Apache-2.0
// SPDX-License-Identifier: MIT
const COMMANDS: &[&str] = &["notify", "request_permission", "is_permission_granted", "register_action_types", "register_listener"];
const COMMANDS: &[&str] = &[
"notify",
"request_permission",
"is_permission_granted",
"register_action_types",
"register_listener",
];
fn main() {
if let Err(error) = tauri_plugin::Builder::new(COMMANDS)

@ -582,6 +582,11 @@ impl Update {
let (updater_type, path, _temp) = Self::extract(bytes)?;
let mut msi_path = std::ffi::OsString::new();
msi_path.push("\"");
msi_path.push(&path);
msi_path.push("\"");
let install_mode = self.config.install_mode();
let installer_args: Vec<&OsStr> = match updater_type {
WindowsUpdaterType::Nsis => install_mode
@ -592,7 +597,7 @@ impl Update {
.chain(self.nsis_installer_args())
.chain(self.installer_args())
.collect(),
WindowsUpdaterType::Msi => [OsStr::new("/i"), path.as_os_str()]
WindowsUpdaterType::Msi => [OsStr::new("/i"), msi_path.as_os_str()]
.into_iter()
.chain(install_mode.msiexec_args().iter().map(OsStr::new))
.chain(once(OsStr::new("/promptrestart")))

Loading…
Cancel
Save