tauri-apps/tauri

[bug] elevated update task failing when project name has spaces

kittuov opened this issue · 0 comments

Describe the bug

Platform: Windows
Bundle: Wix

Elevated update task does not take into consideration any spaces that might be present in the path.
Following command is being run by the update task

<Exec>
      <Command>cmd.exe</Command>
      <Arguments>/c "%SYSTEMROOT%\System32\msiexec.exe /i %TEMP%\\{{product_name}}.msi {{msiexec_args}} /promptrestart"</Arguments>
</Exec>

If either the {{product_name}} or Username (part of %TEMP%) contain spaces, this command will not work.

Solution:
Adding some escape characters should do the trick.

<Exec>
      <Command>cmd.exe</Command>
      <Arguments>/c ^"%SYSTEMROOT%\System32\msiexec.exe /i "%TEMP%\\{{product_name}}.msi" {{msiexec_args}} /promptrestart^"</Arguments>
</Exec>

Reproduction

  1. Create tauri project with productName in tauri.conf.json = Spaced Project
  2. set [enableElevatedUpdateTask](https://v2.tauri.app/reference/config/#enableelevatedupdatetask) to true)
  3. run cargo tauri build.
  4. try to perform the update.

the application closes but no update happens

Expected behavior

Update installs

Full tauri info output

[✔] Environment
    - OS: Windows 10.0.26100 x86_64 (X64)
    ✔ WebView2: 129.0.2792.65
    ✔ MSVC: 
        - Visual Studio Build Tools 2019
        - Visual Studio Community 2022
    ✔ rustc: 1.80.1 (3f5fd8dd4 2024-08-06)
    ✔ cargo: 1.80.1 (376290515 2024-07-16)
    ✔ rustup: 1.27.1 (54dd3d00f 2024-04-24)
    ✔ Rust toolchain: stable-x86_64-pc-windows-msvc (environment override by RUSTUP_TOOLCHAIN)
    - node: 20.9.0
    - pnpm: 9.7.0
    - yarn: 1.22.19
    - npm: 10.8.2

[-] Packages
    - tauri 🦀: 2.0.0
    - tauri-build 🦀: 2.0.0
    - wry 🦀: 0.44.1
    - tao 🦀: 0.30.2
    - tauri-cli 🦀: 2.0.1
    - @tauri-apps/api : 2.0.1
    - @tauri-apps/cli : 2.0.1

[-] Plugins
    - tauri-plugin-store 🦀: 2.0.0
    - @tauri-apps/plugin-store : 2.0.0
    - tauri-plugin-single-instance 🦀: 2.0.0
    - @tauri-apps/plugin-single-instance : not installed!
    - tauri-plugin-shell 🦀: 2.0.0
    - @tauri-apps/plugin-shell : 2.0.0
    - tauri-plugin-updater 🦀: 2.0.1
    - @tauri-apps/plugin-updater : 2.0.0
    - tauri-plugin-autostart 🦀: 2.0.0
    - @tauri-apps/plugin-autostart : 2.0.0

[-] App
    - build-type: bundle
    - CSP: unset
    - frontendDist: ../dist
    - devUrl: http://localhost:1420/
    - framework: React
    - bundler: Vite

Stack trace

No response

Additional context

No response