Use URLSearchParams

This commit is contained in:
Matt Bierner 2022-01-31 16:01:21 -08:00
parent 17900ce21b
commit 967b65e01f
No known key found for this signature in database
GPG key ID: 099C331567E11888

View file

@ -447,10 +447,7 @@ export class WebviewElement extends Disposable implements IWebview, WebviewFindD
params.purpose = options.purpose;
}
const queryString = (Object.keys(params) as Array<keyof typeof params>)
.map((key) => `${key}=${encodeURIComponent(params[key]!)}`)
.join('&');
const queryString = new URLSearchParams(params).toString();
this.element!.setAttribute('src', `${this.webviewContentEndpoint}/index.html?${queryString}`);
}