From 9dc0b49aea1d3bb56b42c3b1bdb6001708a34439 Mon Sep 17 00:00:00 2001 From: Ryan432 <52235584+Ryan432@users.noreply.github.com> Date: Tue, 6 Aug 2024 20:47:48 +0300 Subject: [PATCH] fix(electron-updater,deb): Handle spaces in application artifact name for deb (#8400) --- .changeset/angry-cycles-kick.md | 5 +++++ packages/electron-updater/src/DebUpdater.ts | 5 ++++- 2 files changed, 9 insertions(+), 1 deletion(-) create mode 100644 .changeset/angry-cycles-kick.md diff --git a/.changeset/angry-cycles-kick.md b/.changeset/angry-cycles-kick.md new file mode 100644 index 00000000000..065a34e2e48 --- /dev/null +++ b/.changeset/angry-cycles-kick.md @@ -0,0 +1,5 @@ +--- +"electron-updater": minor +--- + +Handle Linux deb auto update installation on applications having spaces in `artifactName`. diff --git a/packages/electron-updater/src/DebUpdater.ts b/packages/electron-updater/src/DebUpdater.ts index 19705a72ea2..17b60e0663a 100644 --- a/packages/electron-updater/src/DebUpdater.ts +++ b/packages/electron-updater/src/DebUpdater.ts @@ -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()