Skip to content

Commit 5dc0b3d

Browse files
committed
fix(MongoBinaryDownloadUri): new download urls for Win32
Related: #55
1 parent 5bf718b commit 5dc0b3d

File tree

2 files changed

+28
-8
lines changed

2 files changed

+28
-8
lines changed

src/util/MongoBinaryDownloadUrl.js

+27-7
Original file line numberDiff line numberDiff line change
@@ -39,33 +39,53 @@ export default class MongoBinaryDownloadUrl {
3939
}
4040

4141
async getArchiveName(): Promise<string> {
42+
switch (this.platform) {
43+
case 'osx':
44+
return this.getArchiveNameOsx();
45+
case 'win32':
46+
return this.getArchiveNameWin();
47+
case 'linux':
48+
default:
49+
return this.getArchiveNameLinux();
50+
}
51+
}
52+
53+
async getArchiveNameWin(): Promise<string> {
4254
let name = `mongodb-${this.platform}`;
55+
name += `-${this.arch}`;
56+
name += '-2008plus-ssl';
57+
name += `-${this.version}.zip`;
58+
return name;
59+
}
4360

61+
async getArchiveNameOsx(): Promise<string> {
62+
let name = `mongodb-osx`;
4463
if (this.ssl) {
4564
name += '-ssl';
4665
}
66+
name += `-${this.arch}`;
67+
name += `-${this.version}.tgz`;
68+
return name;
69+
}
4770

71+
async getArchiveNameLinux(): Promise<string> {
72+
let name = `mongodb-linux`;
4873
name += `-${this.arch}`;
4974

5075
let osString;
51-
if (this.platform === 'linux' && this.arch !== 'i686') {
76+
if (this.arch !== 'i686') {
5277
if (!this.os) this.os = await this.getos();
5378
osString = this.getLinuxOSVersionString(this.os);
5479
}
55-
5680
if (osString) {
5781
name += `-${osString}`;
5882
}
5983

60-
name += `-${this.version}.${this.getArchiveType()}`;
84+
name += `-${this.version}.tgz`;
6185

6286
return name;
6387
}
6488

65-
getArchiveType(): string {
66-
return this.platform === 'win32' ? 'zip' : 'tgz';
67-
}
68-
6989
async getos(): Promise<OS> {
7090
return new Promise((resolve, reject) => {
7191
getos((e: any, os: any) => {

src/util/__tests__/MongoBinaryDownloadUrl-test.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ describe('MongoBinaryDownloadUrl', () => {
7878
version: '3.6.3',
7979
});
8080
expect(await du.getDownloadUrl()).toBe(
81-
'https://fastdl.mongodb.org/win32/mongodb-win32-x86_64-3.6.3.zip'
81+
'https://fastdl.mongodb.org/win32/mongodb-win32-x86_64-2008plus-ssl-3.6.3.zip'
8282
);
8383
});
8484

0 commit comments

Comments
 (0)