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: github provider prerelease typescript cast #6810

Merged
merged 2 commits into from Apr 24, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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