From a157323431d4b536b86d3f9692626f256785f10e Mon Sep 17 00:00:00 2001 From: Yan Zhang Date: Sun, 21 Nov 2021 13:43:20 +0800 Subject: [PATCH] fix #191: use correct pathname to download project Signed-off-by: Yan Zhang --- src/handler/GenerateProjectHandler.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/handler/GenerateProjectHandler.ts b/src/handler/GenerateProjectHandler.ts index 8ad74fa..863d54b 100644 --- a/src/handler/GenerateProjectHandler.ts +++ b/src/handler/GenerateProjectHandler.ts @@ -4,6 +4,7 @@ import * as extract from "extract-zip"; import * as fse from "fs-extra"; import * as path from "path"; +import { URL } from "url"; import * as vscode from "vscode"; import { instrumentOperationStep } from "vscode-extension-telemetry-wrapper"; import { OperationCanceledError } from "../Errors"; @@ -80,7 +81,10 @@ export class GenerateProjectHandler extends BaseHandler { `baseDir=${this.metadata.artifactId}`, `dependencies=${this.metadata.dependencies.id}`, ]; - return `${this.metadata.serviceUrl}/starter.zip?${params.join("&")}`; + const targetUrl = new URL(this.metadata.serviceUrl); + targetUrl.pathname = "/starter.zip"; + targetUrl.search = `?${params.join("&")}`; + return targetUrl.toString(); } }