Skip to content

Commit

Permalink
fix(updater): escape MSI path (#4737)
Browse files Browse the repository at this point in the history
  • Loading branch information
lucasfernog committed Jul 22, 2022
1 parent 635f23b commit 9af4313
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
5 changes: 5 additions & 0 deletions .changes/fix-windows-updater.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"tauri": patch
---

Escape the MSI file path when running msiexec via powershell.
8 changes: 7 additions & 1 deletion core/tauri/src/updater/core.rs
Original file line number Diff line number Diff line change
Expand Up @@ -789,6 +789,12 @@ fn copy_files_and_run<R: Read + Seek>(
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"])
Expand All @@ -800,7 +806,7 @@ fn copy_files_and_run<R: Read + Seek>(
"-ArgumentList",
])
.arg("/i,")
.arg(&found_path)
.arg(msi_path_arg)
.arg(format!(", {}, /promptrestart;", msiexec_args.join(", ")))
.arg("Start-Process")
.arg(current_exe_arg)
Expand Down

0 comments on commit 9af4313

Please sign in to comment.