Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit8911df1

Browse files
authored
Use truncated version with signature fallback (#574)
Fixes#573
1 parentc26018f commit8911df1

File tree

1 file changed

+12
-3
lines changed

1 file changed

+12
-3
lines changed

‎src/storage.ts‎

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import fs from "fs/promises";
88
import{IncomingMessage}from"http";
99
importpathfrom"path";
1010
importprettyBytesfrom"pretty-bytes";
11+
import*assemverfrom"semver";
1112
import*asvscodefrom"vscode";
1213
import{errToStr}from"./api-helper";
1314
import*asclifrom"./cliManager";
@@ -139,6 +140,12 @@ export class Storage {
139140
// and to log for debugging.
140141
constbuildInfo=awaitrestClient.getBuildInfo();
141142
this.output.info("Got server version",buildInfo.version);
143+
constparsedVersion=semver.parse(buildInfo.version);
144+
if(!parsedVersion){
145+
thrownewError(
146+
`Got invalid version from deployment:${buildInfo.version}`,
147+
);
148+
}
142149

143150
// Check if there is an existing binary and whether it looks valid. If it
144151
// is valid and matches the server, or if it does not match the server but
@@ -230,9 +237,11 @@ export class Storage {
230237
// named exactly the same with an appended `.asc` (such as
231238
// coder-windows-amd64.exe.asc or coder-linux-amd64.asc).
232239
binSource+".asc",
233-
// The releases.coder.com bucket does not include the leading "v".
234-
// The signature name follows the same rule as above.
235-
`https://releases.coder.com/coder-cli/${buildInfo.version.replace(/^v/,"")}/${binName}.asc`,
240+
// The releases.coder.com bucket does not include the leading "v",
241+
// and unlike what we get from buildinfo it uses a truncated version
242+
// with only major.minor.patch. The signature name follows the same
243+
// rule as above.
244+
`https://releases.coder.com/coder-cli/${parsedVersion.major}.${parsedVersion.minor}.${parsedVersion.patch}/${binName}.asc`,
236245
]);
237246
}
238247

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp