electron-builder icon indicating copy to clipboard operation
electron-builder copied to clipboard

GitHubProvider for electron-updater includes incorrect releaseName and releaseNotes when tag includes special characters (+ for egs)

Open PiKouri opened this issue 10 months ago • 7 comments

  • 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 egs 0.0.1+1000
  • We overrode the method isUpdateAvailable in our app, in order to take account of the buildId 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)

PiKouri avatar Aug 11 '23 09:08 PiKouri

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.

github-actions[bot] avatar Oct 11 '23 00:10 github-actions[bot]

up

PiKouri avatar Oct 12 '23 16:10 PiKouri

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.

github-actions[bot] avatar Dec 15 '23 00:12 github-actions[bot]

up

PiKouri avatar Dec 15 '23 08:12 PiKouri

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.

github-actions[bot] avatar Feb 15 '24 00:02 github-actions[bot]

Up

PiKouri avatar Feb 16 '24 09:02 PiKouri

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.

github-actions[bot] avatar Apr 24 '24 00:04 github-actions[bot]