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

fix(windows): No notification in case of an error during signature verification #1681

Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 11 additions & 11 deletions packages/electron-updater/src/NsisUpdater.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,17 @@ export class NsisUpdater extends AppUpdater {
const tempFile = path.join(tempDir, fileInfo.name)
try {
await this.httpExecutor.download(fileInfo.url, tempFile, downloadOptions)

const signatureVerificationStatus = await this.verifySignature(tempFile)
if (signatureVerificationStatus != null) {
try {
await remove(tempDir)
}
finally {
// noinspection ThrowInsideFinallyBlockJS
throw new Error(`New version ${this.versionInfo!.version} is not signed by the application owner: ${signatureVerificationStatus}`)
}
}
}
catch (e) {
try {
Expand All @@ -53,17 +64,6 @@ export class NsisUpdater extends AppUpdater {
throw e
}

const signatureVerificationStatus = await this.verifySignature(tempFile)
if (signatureVerificationStatus != null) {
try {
await remove(tempDir)
}
finally {
// noinspection ThrowInsideFinallyBlockJS
throw new Error(`New version ${this.versionInfo!.version} is not signed by the application owner: ${signatureVerificationStatus}`)
}
}

this._logger.info(`New version ${this.versionInfo!.version} has been downloaded to ${tempFile}`)
this.setupPath = tempFile
this.addQuitHandler()
Expand Down