fix: use encode/decodeURIComponent (#10183)

This commit is contained in:
jrandolf 2023-05-15 12:09:43 +02:00 committed by GitHub
parent d388a6edfd
commit d0c68ff002
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -184,7 +184,7 @@ export class PuppeteerURL {
const [functionName = '', siteString = ''] = url.split(';');
const puppeteerUrl = new PuppeteerURL();
puppeteerUrl.#functionName = functionName;
puppeteerUrl.#siteString = globalThis.atob(siteString);
puppeteerUrl.#siteString = decodeURIComponent(siteString);
return puppeteerUrl;
};
@ -204,9 +204,10 @@ export class PuppeteerURL {
}
toString(): string {
return `pptr:${[this.#functionName, globalThis.btoa(this.#siteString)].join(
';'
)}`;
return `pptr:${[
this.#functionName,
encodeURIComponent(this.#siteString),
].join(';')}`;
}
}