Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issues with spaces in exe name with Squirrel.Windows #2557

Closed
rkistner opened this issue Feb 6, 2018 · 0 comments · May be fixed by qcif/data-curator#563
Closed

Issues with spaces in exe name with Squirrel.Windows #2557

rkistner opened this issue Feb 6, 2018 · 0 comments · May be fixed by qcif/data-curator#563

Comments

@rkistner
Copy link
Contributor

rkistner commented Feb 6, 2018

Version: 19.49.0 (electron-builder and electron-builder-squirrel-windows).
Target: squirrelWindows

Summary of impact

If the productName contains spaces, it will be replaced with %20 in the final exe. Apart from the cosmetic issue, it also causes electron.autoUpdater.quitAndInstall() to break.

Technical details

Since the update to Squirrel.Windows 1.7.x, there seems to be a discrepancy in how spaces (and probably other characters) are escaped in the .nupkg file. Previously Squirrel.Windows escaped the spaces with %20, and unescaped when extracting. With the newer version, this escaping/unescaping has been removed. However, electron-builder-squirrel-windows still escapes the spaces when building, which means the filenames are still escaped after extracting.

For most files I can simply choose to not use spaces. However, for the exe this is more difficult:

  • The exe name can only be controlled by setting "productName": "My Application".
  • productName affects a whole bunch of other things, most significantly the desktop shortcut, and Roaming/... folder name.

Since I need spaces in my shortcut name (having "MyApplication" there is just weird), I can't feasibly remove them from the exe name because of the above.

So because of this, my application ends up as "My%20Application.exe".

If this was just a cosmetic change, it would still be ok. However, this also breaks the electron.autoUpdater.quitAndInstall() process (restarting the app after installing the update). Internally, this calls Squirrel's Update.exe --processStartAndWait "My%20Application.exe". Squirrel tries to be smart, and replaces the %20 with a space when it looks for the exe. Unable to find it, it crashes and shows a nasty error dialog on some machines.

My proposed fix would be to simply remove the encodeURI step from https://github.com/electron-userland/electron-builder/blob/master/packages/electron-builder-squirrel-windows/src/squirrelPack.ts#L245. However, I don't know enough about this to know what else this would affect.

Logs from Update.exe crashing:

2018-02-06 03:54:51> Program: Starting Squirrel Updater: --processStartAndWait My%20Application.exe
2018-02-06 03:54:51> Program: Want to launch '...\app-4.31.2\My Application.exe'
2018-02-06 03:54:51> Program: File ...\app-4.31.2\My Application.exe doesn't exist in current release
2018-02-06 03:54:51> Unhandled exception: System.ArgumentException: Value does not fall within the expected range.
   at Squirrel.Update.Program.ProcessStart(String exeName, String arguments, Boolean shouldWait)
   at Squirrel.Update.Program.executeCommandLine(String[] args)
   at Squirrel.Update.Program.main(String[] args)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants