Skip to content

Commit 2296b4d

Browse files
committed
fix: Fix VSCode download link
1 parent a9ca7a7 commit 2296b4d

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

src/resources/vscode/vscode.ts

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,7 @@ import Schema from './vscode-schema.json';
1717

1818
const VSCODE_APPLICATION_NAME = 'Visual Studio Code.app';
1919

20-
const DOWNLOAD_URL_BASE = 'https://code.visualstudio.com/sha/download';
21-
const DOWNLOAD_LINK_MACOS = 'https://code.visualstudio.com/sha/download?build=stable&os=darwin-universal';
20+
const DOWNLOAD_URL = (platform: string) => `https://update.code.visualstudio.com/latest/${platform}/stable`;
2221

2322
export interface VscodeConfig extends ResourceConfig {
2423
directory: string;
@@ -109,7 +108,7 @@ export class VscodeResource extends Resource<VscodeConfig> {
109108

110109
try {
111110
// Download vscode
112-
await $.spawn(`curl -H "user-agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/88.0.4324.182 Safari/537.36" -SL "${DOWNLOAD_LINK_MACOS}" -o vscode.zip`, { cwd: temporaryDir });
111+
await $.spawn(`curl -H "user-agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/88.0.4324.182 Safari/537.36" -SL "${DOWNLOAD_URL('darwin-universal')}" -o vscode.zip`, { cwd: temporaryDir });
113112
await $.spawn('unzip -q vscode.zip', { cwd: temporaryDir });
114113

115114
// Move VSCode to the applications folder
@@ -129,7 +128,7 @@ export class VscodeResource extends Resource<VscodeConfig> {
129128
const isArm = await Utils.isArmArch();
130129

131130
if (Utils.isDebianBased()) {
132-
const downloadLink = DOWNLOAD_URL_BASE + (isArm ? '?build=stable&os=linux-deb-arm64' : '?build=stable&os=linux-deb-x64');
131+
const downloadLink = DOWNLOAD_URL(isArm ? 'linux-deb-arm64' : 'linux-deb-x64');
133132
const tmpDir = await fs.mkdtemp(path.join(os.tmpdir(), 'vscode-'));
134133
const vscodeDebPath = path.join(tmpDir, 'vscode.deb');
135134

0 commit comments

Comments
 (0)