Skip to content

Commit ae7ddab

Browse files
committed
fix(MongoBinaryDownload): getDownloadUrl: allow DOWNLOAD_MIRROR to add extra paths
fixes #512
1 parent e77f010 commit ae7ddab

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

packages/mongodb-memory-server-core/src/util/MongoBinaryDownloadUrl.ts

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,14 @@ export class MongoBinaryDownloadUrl implements MongoBinaryDownloadUrlOpts {
5555
log(`Using "${mirror}" as the mirror`);
5656

5757
const url = new URL(mirror);
58-
url.pathname = `/${this.platform}/${archive}`;
58+
59+
// ensure that the "mirror" path ends with "/"
60+
if (!url.pathname.endsWith('/')) {
61+
url.pathname = url.pathname + '/';
62+
}
63+
64+
// no extra "/" between "pathname" and "platfrom", because of the "if" statement above to ensure "url.pathname" to end with "/"
65+
url.pathname = `${url.pathname}${this.platform}/${archive}`;
5966

6067
return url.toString();
6168
}

0 commit comments

Comments
 (0)