From ea9c511db851b45e6a27d6dfaacbe9a89340205c Mon Sep 17 00:00:00 2001 From: Asher Date: Tue, 8 Oct 2019 16:23:39 -0500 Subject: [PATCH] Check major version when getting latest version --- src/node/update.ts | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/src/node/update.ts b/src/node/update.ts index a7fa22b39..af58d444d 100644 --- a/src/node/update.ts +++ b/src/node/update.ts @@ -37,9 +37,17 @@ export class UpdateService extends AbstractUpdateService { super(null, configurationService, environmentService, requestService, logService); } - public async isLatestVersion(): Promise { - const latest = await this.getLatestVersion(); - return !latest || latest.name === pkg.codeServerVersion; + public async isLatestVersion(latest?: IUpdate | null): Promise { + if (!latest) { + latest = await this.getLatestVersion(); + } + if (latest) { + const latestMajor = parseInt(latest.name); + const currentMajor = parseInt(pkg.codeServerVersion); + return !isNaN(latestMajor) && !isNaN(currentMajor) && + currentMajor <= latestMajor && latest.name === pkg.codeServerVersion; + } + return true; } protected buildUpdateFeedUrl(): string { @@ -57,7 +65,7 @@ export class UpdateService extends AbstractUpdateService { this.setState(State.CheckingForUpdates(context)); try { const update = await this.getLatestVersion(); - if (!update || !update.name || update.name === pkg.codeServerVersion) { + if (!update || this.isLatestVersion(update)) { this.setState(State.Idle(UpdateType.Archive)); } else { this.setState(State.AvailableForDownload({