From d0c68ff002df37907968d3b999a8273590ac7c97 Mon Sep 17 00:00:00 2001 From: jrandolf <101637635+jrandolf@users.noreply.github.com> Date: Mon, 15 May 2023 12:09:43 +0200 Subject: [PATCH] fix: use encode/decodeURIComponent (#10183) --- packages/puppeteer-core/src/common/util.ts | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/packages/puppeteer-core/src/common/util.ts b/packages/puppeteer-core/src/common/util.ts index 00decd903da..bde06680e4a 100644 --- a/packages/puppeteer-core/src/common/util.ts +++ b/packages/puppeteer-core/src/common/util.ts @@ -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(';')}`; } }