electron-builder
electron-builder copied to clipboard
GitHubProvider for electron-updater includes incorrect releaseName and releaseNotes when tag includes special characters (+ for egs)
- Electron-Builder Version: 24.6.3
- Node Version: 18.6.0
- Electron Version: 24.7.1
- Electron Type (current, beta, nightly):
- Target: Windows
We encountered an issue using electron auto-updater with GitHub Releases :
- The releases are tagged as follows :
${MAJOR}.${MINOR}.${PATCH}+${BUILD_ID}
, which gives for egs0.0.1+1000
- We overrode the method
isUpdateAvailable
in our app, in order to take account of thebuildId
when comparing version. This works fine, as it retrieves the correct assets (latest.yml, .exe, .exe.blockmap
)
The problem is on the releaseName
and releaseNotes
. They do not correspond to the release which is downloaded : they come from another release.
After investigation, the problem comes from the special character +
in the tag, which becomes %2B
in the url : for instance, the url for the release tagged 0.0.1+1000
becomes : https://github.com/{user}/{repo}/releases/tag/0.0.1%2B1001
GitHubProvider.ts, line 96-103:
tag = await this.getLatestTagName(cancellationToken)
for (const element of feed.getElements("entry")) {
// noinspection TypeScriptValidateJSTypes
if (hrefRegExp.exec(element.element("link").attribute("href"))![1] === tag) {
latestRelease = element
break
}
}
GitHubProvider.ts, line 143-149:
if (result.releaseName == null) {
result.releaseName = latestRelease.elementValueOrEmpty("title")
}
if (result.releaseNotes == null) {
result.releaseNotes = computeReleaseNotes(this.updater.currentVersion, this.updater.fullChangelog, feed, latestRelease)
}
As you can see in the code snippets above, in order to retrieve the releaseName and releaseNotes, the method checks the equality of the tag linked to the latest release and the tag in the different release urls : %2B
is different from +
thus it does not find the tagged release, and only takes the latest (in term of date and not with the latest attribute of GitHub Releases)
This issue is stale because it has been open 60 days with no activity. Remove stale label or comment or this will be closed in 30 days.
up
This issue is stale because it has been open 60 days with no activity. Remove stale label or comment or this will be closed in 30 days.
up
This issue is stale because it has been open 60 days with no activity. Remove stale label or comment or this will be closed in 30 days.
Up
This issue is stale because it has been open 60 days with no activity. Remove stale label or comment or this will be closed in 30 days.