From 9af43134e1e58369907281024d31bdb4d16ee6f6 Mon Sep 17 00:00:00 2001 From: Lucas Fernandes Nogueira Date: Fri, 22 Jul 2022 11:23:43 -0300 Subject: [PATCH] fix(updater): escape MSI path (#4737) --- .changes/fix-windows-updater.md | 5 +++++ core/tauri/src/updater/core.rs | 8 +++++++- 2 files changed, 12 insertions(+), 1 deletion(-) create mode 100644 .changes/fix-windows-updater.md diff --git a/.changes/fix-windows-updater.md b/.changes/fix-windows-updater.md new file mode 100644 index 000000000000..f73383c46713 --- /dev/null +++ b/.changes/fix-windows-updater.md @@ -0,0 +1,5 @@ +--- +"tauri": patch +--- + +Escape the MSI file path when running msiexec via powershell. diff --git a/core/tauri/src/updater/core.rs b/core/tauri/src/updater/core.rs index 19ce91def8e3..303c60994559 100644 --- a/core/tauri/src/updater/core.rs +++ b/core/tauri/src/updater/core.rs @@ -789,6 +789,12 @@ fn copy_files_and_run( current_exe_arg.push("\""); current_exe_arg.push(current_exe()?); current_exe_arg.push("\""); + + let mut msi_path_arg = std::ffi::OsString::new(); + msi_path_arg.push("\"\"\""); + msi_path_arg.push(&found_path); + msi_path_arg.push("\"\"\""); + // run the installer and relaunch the application let powershell_install_res = Command::new("powershell.exe") .args(["-NoProfile", "-windowstyle", "hidden"]) @@ -800,7 +806,7 @@ fn copy_files_and_run( "-ArgumentList", ]) .arg("/i,") - .arg(&found_path) + .arg(msi_path_arg) .arg(format!(", {}, /promptrestart;", msiexec_args.join(", "))) .arg("Start-Process") .arg(current_exe_arg)