Skip to content

Commit

Permalink
fix: github provider prerelease check incorrectly casts undefined to …
Browse files Browse the repository at this point in the history
…String. Fixes #6809 (#6810)
  • Loading branch information
blakebyrnes committed Apr 24, 2022
1 parent 8b43098 commit 817e68b
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
5 changes: 5 additions & 0 deletions .changeset/giant-dancers-march.md
@@ -0,0 +1,5 @@
---
"electron-updater": patch
---

fix: github provider prerelease check incorrectly casts undefined to String. Resolves #6809
4 changes: 2 additions & 2 deletions packages/electron-updater/src/providers/GitHubProvider.ts
Expand Up @@ -57,7 +57,7 @@ export class GitHubProvider extends BaseGitHubProvider<GithubUpdateInfo> {
let tag: string | null = null
try {
if (this.updater.allowPrerelease) {
const currentChannel = this.updater?.channel || String(semver.prerelease(this.updater.currentVersion)?.[0]) || null
const currentChannel = this.updater?.channel || semver.prerelease(this.updater.currentVersion)?.[0] as string || null
for (const element of feed.getElements("entry")) {
// noinspection TypeScriptValidateJSTypes
const hrefElement = hrefRegExp.exec(element.element("link").attribute("href"))!
Expand All @@ -68,7 +68,7 @@ export class GitHubProvider extends BaseGitHubProvider<GithubUpdateInfo> {
// This Release's Tag
const hrefTag = hrefElement[1]
//Get Channel from this release's tag
const hrefChannel = semver.prerelease(hrefTag)?.[0] || null
const hrefChannel = semver.prerelease(hrefTag)?.[0] as string || null

const shouldFetchVersion = !currentChannel || ["alpha", "beta"].includes(currentChannel)
const isCustomChannel = !["alpha", "beta"].includes(String(hrefChannel))
Expand Down

0 comments on commit 817e68b

Please sign in to comment.