Răsfoiți Sursa

fix(updater): escape MSI path (#4737)

Lucas Fernandes Nogueira 3 ani în urmă
părinte
comite
9af43134e1
2 a modificat fișierele cu 12 adăugiri și 1 ștergeri
  1. 5 0
      .changes/fix-windows-updater.md
  2. 7 1
      core/tauri/src/updater/core.rs

+ 5 - 0
.changes/fix-windows-updater.md

@@ -0,0 +1,5 @@
+---
+"tauri": patch
+---
+
+Escape the MSI file path when running msiexec via powershell.

+ 7 - 1
core/tauri/src/updater/core.rs

@@ -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"])
@@ -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)