Skip to content

Commit

Permalink
fix(electron-updater,deb): Handle spaces in application artifact name…
Browse files Browse the repository at this point in the history
… for deb (#8400)
  • Loading branch information
Ryan432 authored Aug 6, 2024
1 parent 84f2909 commit 9dc0b49
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
5 changes: 5 additions & 0 deletions .changeset/angry-cycles-kick.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"electron-updater": minor
---

Handle Linux deb auto update installation on applications having spaces in `artifactName`.
5 changes: 4 additions & 1 deletion packages/electron-updater/src/DebUpdater.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,10 @@ export class DebUpdater extends BaseUpdater {
const sudo = this.wrapSudo()
// pkexec doesn't want the command to be wrapped in " quotes
const wrapper = /pkexec/i.test(sudo) ? "" : `"`
const cmd = ["dpkg", "-i", options.installerPath, "||", "apt-get", "install", "-f", "-y"]
// application artifact names may include spaces in their name which leads
// to an error when the install command is executed
const installerPath = options.installerPath.replace(/ /g, "\\ ")
const cmd = ["dpkg", "-i", installerPath, "||", "apt-get", "install", "-f", "-y"]
this.spawnSyncLog(sudo, [`${wrapper}/bin/bash`, "-c", `'${cmd.join(" ")}'${wrapper}`])
if (options.isForceRunAfter) {
this.app.relaunch()
Expand Down

0 comments on commit 9dc0b49

Please sign in to comment.